mirror of
https://github.com/prymitive/karma
synced 2026-05-09 03:36:44 +00:00
Merge pull request #737 from prymitive/check-config
feat(backend): add --check-config flag for validating configuration
This commit is contained in:
7
main.go
7
main.go
@@ -171,7 +171,9 @@ func setupLogger() {
|
||||
|
||||
func main() {
|
||||
printVersion := pflag.Bool("version", false, "Print version and exit")
|
||||
validateConfig := pflag.Bool("check-config", false, "Validate configuration and exit")
|
||||
pflag.Parse()
|
||||
|
||||
if *printVersion {
|
||||
fmt.Println(version)
|
||||
return
|
||||
@@ -204,6 +206,11 @@ func main() {
|
||||
log.Fatal("No valid Alertmanager URIs defined")
|
||||
}
|
||||
|
||||
if *validateConfig {
|
||||
log.Info("Configuration is valid")
|
||||
return
|
||||
}
|
||||
|
||||
// before we start try to fetch data from Alertmanager
|
||||
log.Info("Initial Alertmanager query")
|
||||
pullFromAlertmanager()
|
||||
|
||||
Reference in New Issue
Block a user