Skip to content

Commit

Permalink
Check if the supported namespace regex compiles at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
hashemi-soroush committed Jun 12, 2023
1 parent 89969ec commit a3d23de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package utils

import (
"flag"
"fmt"
"path/filepath"
"regexp"

"github.com/spotahome/redis-operator/operator/redisfailover"
"k8s.io/client-go/util/homedir"
Expand Down Expand Up @@ -39,6 +41,10 @@ func (c *CMDFlags) Init() {
flag.StringVar(&c.LogLevel, "log-level", "info", "set log level")
// Parse flags
flag.Parse()

if _, err := regexp.Compile(c.SupportedNamespacesRegex); err != nil {
panic(fmt.Errorf("supported namespaces Regex is not valid: %w", err))
}
}

// ToRedisOperatorConfig convert the flags to redisfailover config
Expand Down

0 comments on commit a3d23de

Please sign in to comment.