go-scopes/examples/demo/etc/etc.go

33 lines
690 B
Go

package etc
import (
"git.sr.ht/~cco/go-scopes/app"
"git.sr.ht/~cco/go-scopes/config"
"git.sr.ht/~cco/go-scopes/lib"
"git.sr.ht/~cco/go-scopes/logging"
)
func Config() lib.Config {
ovr := Overrides().Use
b := config.MakeBase
cfg := app.Cfg{
Base: b("dummy", app.Start),
Home: ovr(".", HOME),
AppType: "standard",
Logging: &logging.Config{
Logfile: ovr("log/scopes.log", LOGFILE),
},
}
cfg.Add(config.Cfg{
Base: b("config", config.Start),
ConfigFormat: "etc",
})
return &cfg
}
// collect here the names of fields that may be overridden via
// explicit Override() or SCOPES_* environment settings.
const (
HOME = "home"
LOGFILE = "logfile"
)