Skip to content

Commit

Permalink
Out of an abundance of caution, unset the var if it never existed
Browse files Browse the repository at this point in the history
  • Loading branch information
sgmiller committed Feb 28, 2025
1 parent 59a8c11 commit dfb84ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wrappers/azurekeyvault/azurekeyvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,13 @@ func (v *Wrapper) getKeyVaultClient(withCertPool *x509.CertPool) (*azkeys.Client
// Some hoops to jump through to make sure two wrappers being setup at the same time don't step on the
// env var
managedClientIdLock.Lock()
oldVal := os.Getenv(EnvAzureClientId)
oldVal, found := os.LookupEnv(EnvAzureClientId)
unlock := func() {
os.Setenv(EnvAzureClientId, oldVal)
if found {
os.Setenv(EnvAzureClientId, oldVal)
} else {
os.Unsetenv(EnvAzureClientId)
}
managedClientIdLock.Unlock()
}

Expand Down

0 comments on commit dfb84ab

Please sign in to comment.