pcmt/app/config.go
leo aadb409606
All checks were successful
continuous-integration/drone/push Build is passing
go: fully switch to slogging
2023-04-19 05:30:52 +02:00

40 lines
883 B
Go

package app
import (
"errors"
"git.dotya.ml/mirre-mt/pcmt/config"
)
// // SetConfig takes one argument - the config - and sets it if the config has
// // not been set.
// func (a *App) SetConfig(c *config.Config) {
// if a.config == nil {
// a.config = c
// } else {
// a.logger.Println("config already set, not setting it again")
// }
// }
// Config returns config.
func (a *App) Config() *config.Config {
return a.config
}
// PrintConfiguration outputs relevant settings of the application to console.
func (a *App) PrintConfiguration() {
if a.Config() != nil {
if a.Config().LiveMode {
a.Logger().Info("app config: live mode enabled")
}
if a.Config().DevelMode {
a.Logger().Info("app config: devel mode enabled - make sure that browser-sync is running")
}
return
}
panic(errors.New("somehow we got here with config unset - contact the developer"))
}