pcmt/handlers/config.go
leo a879704535
All checks were successful
continuous-integration/drone/push Build is passing
go: partially rework how slogging works
2023-05-09 17:35:00 +02:00

36 lines
633 B
Go

package handlers
import (
"io/fs"
"git.dotya.ml/mirre-mt/pcmt/app/settings"
"git.dotya.ml/mirre-mt/pcmt/slogging"
"golang.org/x/exp/slog"
)
var (
setting *settings.Settings
appver string
slogger *slogging.Logger
log slogging.Logger
tmplPath string
)
func InitHandlers(s *settings.Settings, tmpls fs.FS) {
slogger = slogging.GetLogger()
log = *slogger // have a local copy.
log.Logger = log.Logger.With(
slog.Group("pcmt extra", slog.String("module", "handlers")),
)
setting = s
tmplPath = setting.TemplatesPath()
appver = setting.Version()
log.Debugf("tmpls: %+v", tmpls)
initTemplates(tmpls)
}