Skip to content

Commit

Permalink
Fix cleaning up config file when logging out
Browse files Browse the repository at this point in the history
We previously incorrectly saved a new blank token to the system keyring.
  • Loading branch information
Piccirello committed Apr 28, 2021
1 parent 2d8310c commit e05a30e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cmd/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ func revokeToken(cmd *cobra.Command, args []string) {
// remove key from config
for scope, config := range configuration.AllConfigs() {
if config.Token == token {
updatedConfig := map[string]string{models.ConfigToken.String(): ""}
optionsToUnset := []string{models.ConfigToken.String()}

if updateEnclaveConfig {
if config.EnclaveProject != "" {
updatedConfig[models.ConfigEnclaveProject.String()] = ""
optionsToUnset = append(optionsToUnset, models.ConfigEnclaveProject.String())
}
if config.EnclaveConfig != "" {
updatedConfig[models.ConfigEnclaveConfig.String()] = ""
optionsToUnset = append(optionsToUnset, models.ConfigEnclaveConfig.String())
}
}

configuration.Set(scope, updatedConfig)
configuration.Unset(scope, optionsToUnset)
}
}
}
Expand Down

0 comments on commit e05a30e

Please sign in to comment.