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

Commit

Permalink
Revert Every Change Made Today
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Apr 12, 2020
1 parent 019f931 commit e402a2a
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ const description = `Kamanda is a Firebase CLI Tool extender and should be used
Kamanda provides additional functionality currently not available to via the
Firebase CLI Tool such as User Management, Cloud Firestore Management etc from the CLI.
For instance, it allows you to easily create users with custom tokens, or add custom tokens to a user,
which is currently not very easy in Firebase
`
For instance, it allows you to easily create users with custom tokens,
which is always a trick preposition.`

var cfgFile string

Expand Down Expand Up @@ -69,25 +68,14 @@ func initConfig() {
utils.StdOutError(os.Stderr, "Error checking if config file exists: %s\n", err.Error())
os.Exit(1)
}
// create config file if it doesn't exist
if err != nil && os.IsNotExist(err) {
f, err := os.Create(configPath)
if err != nil {
utils.StdOutError(os.Stderr, "Error while creating config file: %s\n", err.Error())
os.Exit(1)
}
f.Close()
}
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
if err := viper.SafeWriteConfig(); err != nil {
utils.StdOutError(os.Stderr, "The following error occurred while writing kamanda configs: %s\n", err.Error())
}
_ = viper.SafeWriteConfig()
// 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 e402a2a

Please sign in to comment.