Allow specifying config path as an argument

This commit is contained in:
IamTheFij 2020-02-18 00:47:30 +00:00 committed by Ian Fijolek
parent 3b963f420f
commit eb7ad0b25e
1 changed files with 2 additions and 1 deletions

View File

@ -84,6 +84,7 @@ func main() {
flag.BoolVar(&LogDebug, "debug", false, "Enables debug logs (default: false)")
flag.BoolVar(&ExportMetrics, "metrics", false, "Enables prometheus metrics exporting (default: false)")
var showVersion = flag.Bool("version", false, "Display the version of minitor and exit")
var configPath = flag.String("config", "config.yml", "Alternate configuration path (default: config.yml)")
flag.Parse()
// Print version if flag is provided
@ -93,7 +94,7 @@ func main() {
}
// Load configuration
config, err := LoadConfig("config.yml")
config, err := LoadConfig(*configPath)
if err != nil {
log.Fatalf("Error loading config: %v", err)
}