wings cmd: add config flag

This commit is contained in:
Jakob Schrettenbrunner 2017-08-31 23:59:35 +02:00
parent 09d2d6ec4a
commit 4800c21be4

View File

@ -17,8 +17,10 @@ var RootCommand = &cobra.Command{
Run: run, 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 // Execute registers the RootCommand
@ -29,7 +31,7 @@ func Execute() {
func run(cmd *cobra.Command, args []string) { func run(cmd *cobra.Command, args []string) {
tools.InitLogging() tools.InitLogging()
log.Info("Loading configuration") 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") log.WithError(err).Fatal("Failed to find configuration file")
} }
tools.ConfigureLogging() tools.ConfigureLogging()