Skip to content

Commit

Permalink
Add config validation option (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-lukyanchikov authored and brian-brazil committed Apr 1, 2018
1 parent 4a22506 commit bedf262
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
configFile = kingpin.Flag("config.file", "Blackbox exporter configuration file.").Default("blackbox.yml").String()
listenAddress = kingpin.Flag("web.listen-address", "The address to listen on for HTTP requests.").Default(":9115").String()
timeoutOffset = kingpin.Flag("timeout-offset", "Offset to subtract from timeout in seconds.").Default("0.5").Float64()
configCheck = kingpin.Flag("config.check", "If true validate the config file and then exit.").Default().Bool()

Probers = map[string]prober.ProbeFn{
"http": prober.ProbeHTTP,
Expand Down Expand Up @@ -217,6 +218,12 @@ func main() {
level.Error(logger).Log("msg", "Error loading config", "err", err)
os.Exit(1)
}

if *configCheck {
level.Info(logger).Log("msg", "Config file is ok exiting...")
os.Exit(0)
}

level.Info(logger).Log("msg", "Loaded config file")

hup := make(chan os.Signal)
Expand Down

0 comments on commit bedf262

Please sign in to comment.