From ee176b2f5de65274deba8ec525a90755f7c59605 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Wed, 17 Jun 2015 19:19:02 -0700 Subject: [PATCH] command/auth: warn about the VAULT_TOKEN env var. Fixes #195 --- command/auth.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/command/auth.go b/command/auth.go index 130dd7d278..46ea4657a5 100644 --- a/command/auth.go +++ b/command/auth.go @@ -173,6 +173,15 @@ func (c *AuthCommand) Run(args []string) int { return 1 } + // Warn if the VAULT_TOKEN environment variable is set, as that will take + // precedence + if os.Getenv("VAULT_TOKEN") != "" { + c.Ui.Output("==> WARNING: VAULT_TOKEN environment variable set!\n") + c.Ui.Output(" The environment variable takes precedence over the value") + c.Ui.Output(" set by the auth command. Either update the value of the") + c.Ui.Output(" environment variable or unset it to use the new token.\n") + } + // Get the policies we have policiesRaw, ok := secret.Data["policies"] if !ok {