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/lib/action" "git.sr.ht/~cco/go-scopes/lib/core" "git.sr.ht/~cco/go-scopes/logging" "git.sr.ht/~cco/go-scopes/testing" ) func Config() lib.Config { ovr := Overrides().Use b := config.MakeBase cfg := app.Cfg{ Base: b("testing", testing.Start), Home: ovr(".", HOME), AppType: "standard", Logging: &logging.Config{ Logfile: ovr("log/scopes.log", LOGFILE), }, } cfg.AddAction("demo", action.BaseSpec(action.Forward, []string{"test-receiver"})) cfg_config := config.Cfg{ Base: b("config", config.Start), ConfigFormat: "etc", } cfg.Add(cfg_config) cfg_test_rcvr := b("test-receiver", core.Start) cfg_test_rcvr.AddAction("demo", action.BaseSpec(AH_Receiver, nil)) cfg.Add(cfg_test_rcvr) return &cfg } // register action handlers from ..._test.go here. var ( AH_Receiver lib.ActionHandler ) // collect here the names of fields that may be overridden via // explicit Override() or SCOPES_* environment settings. const ( HOME = "home" LOGFILE = "logfile" ) // in a production scenario this should be put in a separate // file `settings.go` that should not be stored in code repository. func Overrides() config.Settings { return config.Settings{ HOME: "tests", } }