leo
8cc43bba13
All checks were successful
continuous-integration/drone/push Build is passing
* make all packages use the logger * add a couple of convenience methods on the logger that enable formatting using fmt syntax
41 lines
662 B
Go
41 lines
662 B
Go
package handlers
|
|
|
|
import (
|
|
"io/fs"
|
|
|
|
"git.dotya.ml/mirre-mt/pcmt/config"
|
|
"git.dotya.ml/mirre-mt/pcmt/slogging"
|
|
)
|
|
|
|
var (
|
|
conf *config.Config
|
|
appver string
|
|
log *slogging.Logger
|
|
)
|
|
|
|
func setConfig(c *config.Config) {
|
|
if c != nil {
|
|
log.Info("setting handler config")
|
|
// c = conf
|
|
conf = c
|
|
log.Infof("set handler config to %#v", c)
|
|
} else {
|
|
log.Warn("error passing conf to handlers")
|
|
}
|
|
}
|
|
|
|
func getConfig() *config.Config {
|
|
return conf
|
|
}
|
|
|
|
func setAppVer(v string) {
|
|
appver = v
|
|
}
|
|
|
|
func InitHandlers(version string, appconf *config.Config, tmpls fs.FS) {
|
|
log = slogging.GetLogger()
|
|
setConfig(appconf)
|
|
setAppVer(version)
|
|
initTemplates(tmpls)
|
|
}
|