automatically update config file permissions

This commit is contained in:
Samuel Lorch 2021-12-17 16:42:55 +01:00
parent 7f3059db95
commit bf4a0c8d4a

View file

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