From 881d5aa5609c4d1fa4d6fab00481197dce66751d Mon Sep 17 00:00:00 2001 From: yukiyan Date: Thu, 27 Apr 2017 16:28:02 +0900 Subject: [PATCH] Fix config flag behavior --- cmd/root.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index eef7c08..cdaa907 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -73,10 +73,11 @@ func init() { func initConfig() { if cfgFile != "" { // enable ability to specify config file via flag viper.SetConfigFile(cfgFile) + } else { + viper.SetConfigName(".ecs-formation") // name of config file (without extension) + viper.AddConfigPath("$HOME") // adding home directory as first search path } - viper.SetConfigName(".ecs-formation") // name of config file (without extension) - viper.AddConfigPath("$HOME") // adding home directory as first search path viper.AutomaticEnv() // read in environment variables that match // If a config file is found, read it in.