more minor config improvements

This commit is contained in:
Helmut Merz 2023-06-25 14:54:23 +02:00
parent c241c8ff73
commit 82deb2c7f2
2 changed files with 10 additions and 12 deletions

View file

@ -22,7 +22,7 @@ func (spec *baseSpec) Receivers() []string {
return spec.receivers
}
func Base(hdlr lib.ActionHandler, rcvrs []string) *baseSpec {
func Base(hdlr lib.ActionHandler, rcvrs ...string) *baseSpec {
return &baseSpec{hdlr, rcvrs}
}
@ -47,7 +47,7 @@ func match(ac lib.ActionConfig, msg lib.Message) bool {
//return false
}
// action
// action handling
type action struct {
ctx lib.Context

View file

@ -14,7 +14,7 @@ func Config() lib.Config {
ovr := Overrides().Use
b := config.Base
app_c := app.Cfg{
app_c := &app.Cfg{
BaseCfg: b("testing", testing.Start),
Home: ovr(".", HOME),
AppType: "standard",
@ -22,21 +22,19 @@ func Config() lib.Config {
Logfile: ovr("log/scopes.log", LOGFILE),
},
}
app_c.AddAction("demo",
action.Base(action.Forward,
[]string{"test-receiver"}))
app_c.AddAction("demo", action.Base(action.Forward, "test-receiver"))
config_c := config.Cfg{
config_c := &config.Cfg{
BaseCfg: b("config", config.Start),
ConfigFormat: "etc",
}
app_c.Add(config_c)
test_rcvr := b("test-receiver", core.Start)
test_rcvr.AddAction("demo", action.Base(AH_Receiver, nil))
app_c.Add(test_rcvr)
test_rcvr := b("test-receiver", core.Start).
AddAction("demo", action.Base(AH_Receiver))
return &app_c
app_c.Add(config_c, test_rcvr)
return app_c
}
// register action handlers from ..._test.go here.