From 4800c21be4e902bc6c25dff4ab6e2af7be9e1602 Mon Sep 17 00:00:00 2001 From: Jakob Schrettenbrunner Date: Thu, 31 Aug 2017 23:59:35 +0200 Subject: [PATCH] wings cmd: add config flag --- command/root.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command/root.go b/command/root.go index 9eb059d..ba4d945 100644 --- a/command/root.go +++ b/command/root.go @@ -17,8 +17,10 @@ var RootCommand = &cobra.Command{ Run: run, } -func init() { +var configPath string +func init() { + RootCommand.Flags().StringVarP(&configPath, "config", "c", "./config.json", "Allows to set the path of the configuration file.") } // Execute registers the RootCommand @@ -29,7 +31,7 @@ func Execute() { func run(cmd *cobra.Command, args []string) { tools.InitLogging() log.Info("Loading configuration") - if err := config.LoadConfiguration(""); err != nil { + if err := config.LoadConfiguration(configPath); err != nil { log.WithError(err).Fatal("Failed to find configuration file") } tools.ConfigureLogging()