Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers/vault: add a debug log when VAULT_TOKEN env var is used #1333

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading