~nvkv/amitm

9e78476adcc9b1ebd2ea98fd4ba94d4cb06bceb5 — Semyon Novikov 3 months ago decc8d6
Add Rules lookup for config
1 files changed, 5 insertions(+), 0 deletions(-)

M internal/config/v1/config.go
M internal/config/v1/config.go => internal/config/v1/config.go +5 -0
@@ 21,6 21,11 @@ type Config struct {
	Rules     []Rule
}

func (cfg *Config) RulesForAction(action string) ([]*Rule, bool) {
	rules, ok := cfg.actionmap[action]
	return rules, ok
}

func ReadConfigFile(path string) (*Config, error) {
	data, err := ioutil.ReadFile(path)
	if err != nil {