Variable substitution in environments
Environment limitations
- It's not possible to enable multiple environments simultaneously.
- You can't use variables defined in a sub-environment to reference values defined in the base environment.
Workaround
Instead of using the environment selector, place all configuration into the base environment like so:
{
"envs": {
"prod": {
"url": "https://service.example.com",
"users": {
"admin": {
"user": "admin",
"pass": "hunter2"
},
"user": {
"user": "user",
"pass": "hunter2"
}
}
},
{
"preprod": {
"url": "https://service.preprod.example.com",
"users": {
"admin": {
"user": "admin",
"pass": "hunter2"
},
"user": {
"user": "user",
"pass": "hunter2"
}
}
}
},
"env": "preprod",
"user": "admin"
}
You can now use the following references to access different environments and users:
{{ _.envs[_.env].url }}
{{ _.envs[_.env].users[_.user].user }}
{{ _.envs[_.env].users[_.user].pass }}
Backlinks