61 lines
1.4 KiB
Go
61 lines
1.4 KiB
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/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.Base
|
|
|
|
app_c := &app.Cfg{
|
|
BaseCfg: b("testing", testing.Start),
|
|
Home: ovr(".", HOME),
|
|
AppType: "standard",
|
|
Logging: &logging.Cfg{
|
|
Logfile: ovr("log/scopes.log", LOGFILE),
|
|
Level: ovr("info", LOGLEVEL),
|
|
},
|
|
}
|
|
app_c.AddAction("demo", action.Base(action.Forward, "test-receiver"))
|
|
|
|
config_c := &config.Cfg{
|
|
BaseCfg: b("config", config.Start),
|
|
ConfigFormat: "etc",
|
|
}
|
|
|
|
test_rcvr := b("test-receiver", core.Start).
|
|
AddAction("demo", action.Base(AH_Receiver))
|
|
|
|
app_c.Add(config_c, test_rcvr)
|
|
|
|
return app_c
|
|
}
|
|
|
|
// 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"
|
|
LOGLEVEL = "loglevel"
|
|
)
|
|
|
|
// 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",
|
|
LOGLEVEL: "debug",
|
|
}
|
|
}
|