38 lines
613 B
Go
38 lines
613 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 setAppVer(v string) {
|
|
appver = v
|
|
}
|
|
|
|
func InitHandlers(version string, appconf *config.Config, tmpls fs.FS) {
|
|
log = slogging.GetLogger()
|
|
|
|
setConfig(appconf)
|
|
setAppVer(version)
|
|
initTemplates(tmpls)
|
|
}
|