Skip to content

Commit 225d79a

Browse files
brycenicholsbryce
authored andcommitted
Add documentation and examples for -u and -x flags to README
1 parent 3ff0ab3 commit 225d79a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,33 @@ list-buckets: creds.yml
8383
buildenv -e stage -f $< -r "aws s3 ls"
8484
```
8585

86-
*A Note About Vault:* If you have `secrets` or `kv_secrets` defined in either the global or environment scope, it's a mapping from environment variable to the path & key in vault. Buildenv uses all the standard vault environment variables to communicate with vault (`VAULT_ADDR` and `VAULT_TOKEN` being the two you're most likely to use.) You can find the complete list [in the vault client docs](https://pkg.go.dev/github.com/hashicorp/[email protected]#WithEnvironment).
86+
If it's necessary to merge or save a set of variables (for example, so that vault does not need to be called repeatedly), the -u option allows for saving and using a set of variables from the environment without writing possibly sensitive data out to a file:
87+
88+
```bash
89+
% export SAVED_ENV=`echo '{"example_var": "the value"}' | base64`
90+
% buildenv -u SAVED_ENV -f /dev/null
91+
export example_var="the value"
92+
```
93+
94+
This takes a base64 encoded json object with key-value pairs and treats them as additional input variables. The corresponding flag for export in the same format is -x:
95+
96+
```bash
97+
% buildenv -u SAVED_ENV -f /dev/null -x | base64 -d
98+
{"example_var":"the value"}
99+
```
100+
101+
Multiple -u options can be used as well as combined with -f to combine multiple sources. Given the above variables.yml:
87102

103+
```bash
104+
% export SAVED_ENV=`echo '{"example_var": "the value"}' | base64`
105+
% export SAVED_ENV2=`echo '{"another_var": "another value"}' | base64`
106+
% buildenv -u SAVED_ENV -u SAVED_ENV2 -v
107+
export GLOBAL="global"
108+
export example_var="the value"
109+
export another_var="another value"
110+
```
111+
112+
*A Note About Vault:* If you have `secrets` or `kv_secrets` defined in either the global or environment scope, it's a mapping from environment variable to the path & key in vault. Buildenv uses all the standard vault environment variables to communicate with vault (`VAULT_ADDR` and `VAULT_TOKEN` being the two you're most likely to use.) You can find the complete list [in the vault client docs](https://pkg.go.dev/github.com/hashicorp/[email protected]#WithEnvironment).
88113

89114
Running on Linux or in Docker container
90115
----------

0 commit comments

Comments
 (0)