Skip to content

Commit

Permalink
providers/vault: add a debug log when VAULT_TOKEN env var is used (#1333
Browse files Browse the repository at this point in the history
)
  • Loading branch information
edganiukov authored Sep 27, 2024
1 parent bcf05fe commit df94e75
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/providers/vault/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ package vault

import (
"context"
"fmt"
"os"

vaultclient "github.com/hashicorp/vault-client-go"
"namespacelabs.dev/foundation/framework/secrets/combined"
"namespacelabs.dev/foundation/internal/console"
"namespacelabs.dev/foundation/internal/fnerrors"
"namespacelabs.dev/foundation/internal/tcache"
"namespacelabs.dev/foundation/std/cfg"
Expand Down Expand Up @@ -58,6 +60,7 @@ func login(ctx context.Context, vaultCfg *vault.VaultProvider) (*vaultclient.Cli
// Vault by default always prefers a token set in VAULT_TOKEN env var. We do the same.
// Useful in case of VAULT_TOKEN provided by the 3rd party (e.g. by CI, etc).
if token := os.Getenv("VAULT_TOKEN"); token != "" {
fmt.Fprintf(console.Debug(ctx), "skipping login as envroment variable VAULT_TOKEN is set\n")
client.SetToken(token)
return client, nil
}
Expand Down

0 comments on commit df94e75

Please sign in to comment.