Skip to content

Commit

Permalink
automatically update config file permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
speatzle committed Dec 17, 2021
1 parent 7f3059d commit bf4a0c8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit bf4a0c8

Please sign in to comment.