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

View file

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