You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A tool for generating environment exports from a YAML file. _Now with vault integration!_
4
+
A tool for generating environment exports from a YAML file. Variables can be set in plain test, or by specifying vault key-value (version 2) paths and keys (`kv_secrets`) or the older generic / kv paths (`secrets`) where the key name "value" is assumed.
5
5
6
6
Usage
7
7
-----
8
8
9
9
Given a `variables.yml` file like this:
10
10
```yaml
11
11
---
12
-
vars:
13
-
GLOBAL: "global"
14
-
15
-
secrets:
16
-
SECRET_TEST: "secret/test"
17
-
18
-
environments:
19
-
stage:
20
-
vars:
21
-
ENVIRONMENT: "stage"
22
-
23
-
secrets:
24
-
ANOTHER_SECRET: "secret/test2"
25
-
26
-
dcs:
27
-
ndc_one:
28
-
secrets:
29
-
YET_ANOTHER_SECRET: "secret/test3"
30
-
vars:
31
-
DC: "one"
32
-
33
-
ndc_two:
34
-
secrets:
35
-
YET_ANOTHER_SECRET: "secret/test3"
36
-
vars:
37
-
DC: "one"
12
+
vars:
13
+
GLOBAL: "global"
14
+
15
+
secrets:
16
+
GENERIC_SECRET: "gen/test"
17
+
KV_SECRET: "old/test"
18
+
KV2_SECRET: "secret/oldstyle"
19
+
20
+
kv_secrets:
21
+
- path: "secret/test"
22
+
vars:
23
+
KV2_ONE: "one"
24
+
KV2_TWO: "two"
25
+
- path: "old/test"
26
+
vars:
27
+
KV1: "value"
28
+
- path: "gen/test"
29
+
vars:
30
+
KV_GENERIC: "value"
31
+
32
+
environments:
33
+
stage:
34
+
vars:
35
+
ENVIRONMENT: "stage"
36
+
37
+
secrets:
38
+
ANOTHER_SECRET: "secret/oldstyle"
39
+
40
+
dcs:
41
+
ndc_one:
42
+
vars:
43
+
DC: "one"
44
+
kv_secrets:
45
+
- path: "old/test"
46
+
vars:
47
+
KV2_THREE: "three"
38
48
```
39
49
40
50
Output would look like this:
41
51
42
52
```
43
-
% buildenv -e stage -d ndc_one
44
-
# Setting Variables for:
45
-
# Environment: stage
46
-
# Datacenter: ndc_one
47
-
# Global Vars:
53
+
% buildenv -c -e stage -d ndc_one
54
+
# Global Variables
48
55
export GLOBAL="global"
49
-
# Global Secrets:
50
-
export SECRET_TEST="It Works" # secret/test
51
-
# Environment (stage) Vars:
56
+
export KV2_ONE="1" # Path: secret/test, Key: one
57
+
export KV2_TWO="2" # Path: secret/test, Key: two
58
+
export KV1="old" # Path: old/test, Key: value
59
+
export KV_GENERIC="generic" # Path: gen/test, Key: value
60
+
export GENERIC_SECRET="generic" # Path: gen/test, Key: value
61
+
export KV_SECRET="old" # Path: old/test, Key: value
62
+
export KV2_SECRET="default" # Path: secret/oldstyle, Key: value
63
+
# Environment: stage
52
64
export ENVIRONMENT="stage"
53
-
# Environment (stage) Secrets:
54
-
export ANOTHER_SECRET="It Still Works" # secret/test
55
-
# Datacenter (ndc_one) Specific Vars:
56
-
YET_ANOTHER_SECRET: "secretpassword"
65
+
export ANOTHER_SECRET="default" # Path: secret/oldstyle, Key: value
66
+
# Datacenter: ndc_one
57
67
export DC="one"
68
+
export KV2_THREE="3" # Path: old/test, Key: three
58
69
```
59
70
60
-
*A Note About Vault:* If you have `secrets` defined in either the global or environment scope, it's a mapping from environment variable to the path 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.)
71
+
*A Note About Vault:* If you have `secrets` defined in either the global or environment scope, it's a mapping from environment variable to the path 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/vault-client-go@v0.4.2#WithEnvironment).
0 commit comments