diff --git a/cmd/root.go b/cmd/root.go index c139eea..8e49bb1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -84,7 +84,11 @@ func initConfig() { viper.AutomaticEnv() // read in environment variables that match // If a config file is found, read it in. - if err := viper.ReadInConfig(); err == nil && viper.GetBool("debug") { - fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed()) + if err := viper.ReadInConfig(); err == nil { + if viper.GetBool("debug") { + fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed()) + } + // update Config file Permissions + os.Chmod(viper.ConfigFileUsed(), 0600) } }