DM-49929: Load OP_CONNECT_TOKEN and VAULT_TOKEN from 1Password via env file #4486
+132
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR takes advantage of the 1Password CLI's ability to load secrets referenced by their path in a .env file. With this change, admins no longer need to manually load the VAULT_TOKEN and OP_CONNECT_TOKEN into their shell environments to run phalanx commands like
phalanx secrets sync
. An example usage is:Note that I've had the user set PHALANX_ENV, which is used to specify secret paths in
square.env
specific to that Phalanx environment. I've also modified the Phalanx CLI to acceptPHALANX_ENV
as an environment variable instead of as a command-line argument.Note an alternative approach could be to have a separate
.env
file for each Phalanx environment. This would let us setPHALANX_ENV
in that file, and make the resulting CL invocations shorter, at the small cost fo maintaining more.env
files. E.g.op run --env-file="op/idfprod.env" -- phalanx secrets audit
What do you think? Perhaps this second approach would provide a better user experience.