Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
Fix Issue with Being Unable to Create Config File
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Apr 12, 2020
1 parent e402a2a commit be36e9b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ func initConfig() {
utils.StdOutError(os.Stderr, "Error checking if config file exists: %s\n", err.Error())
os.Exit(1)
}
cfgFile = configPath
viper.SetConfigFile(configPath)
}
viper.Set(configs.GoogleOAuthClientIDConfigKey, GOOGLE_OAUTH_CLIENT_ID)
viper.Set(configs.GoogleOAuthClientSecretConfigKey, GOOGLE_OAUTH_CLIENT_SECRET)
viper.AutomaticEnv()
// @todo: improve error handling here, i.e fail if error is due to missing
// config file
_ = viper.SafeWriteConfig()
_ = viper.SafeWriteConfigAs(cfgFile) // creates config file if doesn't exist
// bind token flag to refresh token config, overriding incase token is supplied
if err := viper.BindPFlag(configs.FirebaseRefreshTokenViperConfigKey, rootCmd.Flags().Lookup("token")); err != nil {
utils.StdOutError(os.Stderr, "Error bind token flag: %s\n", err.Error())
Expand Down

0 comments on commit be36e9b

Please sign in to comment.