From 9e78476adcc9b1ebd2ea98fd4ba94d4cb06bceb5 Mon Sep 17 00:00:00 2001 From: Semyon Novikov Date: Mon, 23 Nov 2020 12:00:02 +0500 Subject: [PATCH] Add Rules lookup for config --- internal/config/v1/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/config/v1/config.go b/internal/config/v1/config.go index 264e9d6..cf756f4 100644 --- a/internal/config/v1/config.go +++ b/internal/config/v1/config.go @@ -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 { -- 2.30.1