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

Either mention the NOMAD_TOKEN env var or automatically export NOMAD_TOKEN as part of ACL bootstrapping #10272

Open
DingoEatingFuzz opened this issue Mar 31, 2021 · 1 comment

Comments

@DingoEatingFuzz
Copy link
Contributor

Proposal

Either mention the NOMAD_TOKEN env var or automatically export NOMAD_TOKEN as part of nomad acl bootstrap

$ nomad acl bootstrap
Accessor ID  = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Secret ID    = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Name         = Bootstrap Token
Type         = management
Global       = true
Policies     = n/a
Create Time  = 2021-03-31 17:08:45.468415 +0000 UTC
Create Index = 10
Modify Index = 10

Local envvar NOMAD_TOKEN has been set to Secret ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Or

$ nomad acl bootstrap
...snipped...

To continue using Nomad, run
export NOMAD_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Use-cases

This is a missed opportunity to teach the ACL system inline rather than relying on guides/docs.

@lgfa29
Copy link
Contributor

lgfa29 commented Feb 3, 2023

Modifying the current shell by exporting a variable is not possible, so printing the message would be way to go and it provides user two important information: what is the expected environment variable name and which value they should set.

#15894 discusses adding -json and -t to commands. When these flags are used the NOMAD_TOKEN message should not displayed. With a structure output option users will be able to modify their current shell session by doing something like:

$ eval "export NOMAD_TOKEN=$(nomad acl bootstrap -json | jq ".SecretID")"

Setting an environment variable is also OS specific, so instead of providing an exact command to run (which may not work for the user), the message should explain in broad terms that a NOMAD_TOKEN environment variable should be set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants