diff --git a/.golangci.yml b/.golangci.yml index ae4fb9e..7c00ea2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -35,7 +35,7 @@ linters-settings: dupl: threshold: 150 funlen: - Lines: 175 + Lines: 180 Statements: 75 goconst: min-len: 2 diff --git a/main.go b/main.go index b9bf5c9..8e3db8d 100644 --- a/main.go +++ b/main.go @@ -86,6 +86,7 @@ type Config struct { Labels map[string]string `default:"" desc:"Endpoint labels"` ACLConfigPath string `default:"/etc/vppagent-firewall/config.yaml" desc:"Path to ACL config file" split_words:"true"` ACLConfig []acl_types.ACLRule `default:"" desc:"configured acl rules"` + LogLevel string `default:"INFO" desc:"Log level" split_words:"true"` } // Process prints and processes env to config @@ -140,6 +141,11 @@ func main() { if err := config.Process(); err != nil { logrus.Fatal(err.Error()) } + l, err := logrus.ParseLevel(config.LogLevel) + if err != nil { + logrus.Fatalf("invalid log level %s", config.LogLevel) + } + logrus.SetLevel(l) config.retrieveACLRules(ctx)