48 lines
1.1 KiB
Go
48 lines
1.1 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/testing"
|
|
)
|
|
|
|
func Config() lib.Config {
|
|
ovr := Overrides().Use
|
|
b := config.MakeBase
|
|
cfg := app.Cfg{
|
|
Base: b("testing", testing.Start).
|
|
WithMessageHandler(core.HandleMessage),
|
|
Home: ovr(".", HOME),
|
|
AppType: "standard",
|
|
}
|
|
cfg.Add(config.Cfg{
|
|
Base: b("config", config.Start),
|
|
ConfigFormat: "etc",
|
|
})
|
|
cfg.Add(b("test-receiver", core.Start).
|
|
WithAction("*", action.BaseSpec(AH_Receiver, nil)))
|
|
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"
|
|
)
|
|
|
|
// 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",
|
|
}
|
|
}
|