Skip to content

Commit

Permalink
feat: add config validation flag
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark committed Oct 2, 2024
1 parent eb1e2de commit ede9550
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/balance-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func main() {

flags.String("config", "", "Configuration file")
flags.Bool("version", false, "Show version information")
flags.Bool("validate", false, "Validate configuration and exit")

_ = flags.Parse(os.Args[1:])

Expand Down Expand Up @@ -92,6 +93,10 @@ func main() {
os.Exit(1)
}

if v, _ := flags.GetBool("validate"); v {
os.Exit(0)
}

extraResources, _ := resource.New(
context.Background(),
resource.WithContainer(),
Expand Down
5 changes: 5 additions & 0 deletions cmd/notification-service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func main() {

flags.String("config", "", "Configuration file")
flags.Bool("version", false, "Show version information")
flags.Bool("validate", false, "Validate configuration and exit")

_ = flags.Parse(os.Args[1:])

Expand Down Expand Up @@ -94,6 +95,10 @@ func main() {
os.Exit(1)
}

if v, _ := flags.GetBool("validate"); v {
os.Exit(0)
}

extraResources, _ := resource.New(
context.Background(),
resource.WithContainer(),
Expand Down
5 changes: 5 additions & 0 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func main() {

flags.String("config", "", "Configuration file")
flags.Bool("version", false, "Show version information")
flags.Bool("validate", false, "Validate configuration and exit")

_ = flags.Parse(os.Args[1:])

Expand Down Expand Up @@ -117,6 +118,10 @@ func main() {
os.Exit(1)
}

if v, _ := flags.GetBool("validate"); v {
os.Exit(0)
}

extraResources, _ := resource.New(
context.Background(),
resource.WithContainer(),
Expand Down
5 changes: 5 additions & 0 deletions cmd/sink-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func main() {

flags.String("config", "", "Configuration file")
flags.Bool("version", false, "Show version information")
flags.Bool("validate", false, "Validate configuration and exit")

_ = flags.Parse(os.Args[1:])

Expand Down Expand Up @@ -88,6 +89,10 @@ func main() {
os.Exit(1)
}

if v, _ := flags.GetBool("validate"); v {
os.Exit(0)
}

extraResources, _ := resource.New(
ctx,
resource.WithContainer(),
Expand Down

0 comments on commit ede9550

Please sign in to comment.