Skip to content

Commit

Permalink
Core: CLI imporvement to show Warning message when VAULT_ADDR or -add…
Browse files Browse the repository at this point in the history
…ress is not set. Resolves hashicorp#9684.
  • Loading branch information
aphorise committed Sep 4, 2022
1 parent 700852c commit 6f3328f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/17008.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
core/cli: Warning related to VAULT_ADDR & -address not set with CLI requests.
```
4 changes: 4 additions & 0 deletions command/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ func (c *BaseCommand) flagSet(bit FlagSetBit) *FlagSets {
addrStringVar.Default = c.flagAddress
} else {
addrStringVar.Default = "https://127.0.0.1:8200"
// if no VAULT_ADDR or -address provided then give warning.
if os.Getenv("VAULT_ADDR") == "" {
c.UI.Warn("WARNING: neither VAULT_ADDR nor the -address parameter is set. Defaulting to loopback address (https://127.0.0.1:8200).")
}
}
f.StringVar(addrStringVar)

Expand Down

0 comments on commit 6f3328f

Please sign in to comment.