go-scopes/tests/etc/etc.go

34 lines
744 B
Go

package etc
import (
"git.sr.ht/~cco/go-scopes"
"git.sr.ht/~cco/go-scopes/config"
)
func Config() config.Config {
ovr := Overrides().Get
b := config.MakeBase
cfg := scopes.Cfg{
Base: b("dummy", scopes.Start),
Home: ovr(HOME, "."),
AppType: "standard",
}
cfg.Add(config.Cfg{b("config", config.Start), "etc"})
return &cfg
}
// collect here the names of fields that may be overridden via
// explicit Override() or SCOPES_* environment settings.
const (
NAME = "name"
HOME = "home"
)
// in a production scenario this should be put in separate
// file `settings.go` that should not be stored in code repository.
func Overrides() config.Settings {
return config.Settings{
NAME: "overridden",
HOME: "/home/scopes",
}
}