Configure Loading Variables
Configure Archibald Config
Providing the Values through the above-mentioned methods is not enough though, you still need to tell Archibald when you want to load them. There are two ways how to load the variables. Per default the runtime version is active.
1. Buildtime:
In this configuration the variables are loaded from the .env file during build time. When they are not available, the placehodlers stay in the config and have a second chance during runtime. When they are also not available there it gets substituted with the fallback which was defined after the pipe.
{
...
"cli": {
"env": true
},
...
}
2. Runtime:
In this configuration the variables are loaded from the .env file during run time, which means start up of the server. When nothing is available the fallback which was defined after the pipe is being loaded into the configuration.
{
...
"project": {
"env": true
},
...
}
Configure Env Attribute
You can provide a boolen and a string to the env property.
1. Change the path where to find the .env file:
When env is provided as a boolean, the Framework will try to load .env.{environment} and when that file isn't found it will load .env.
{
...
"project": {
"env": true
},
...
}
1. Change the path where to find the .env file:
{
...
"project": {
"env": "./new/.env"
},
...
}
2. And or configure the path with placeholders:
Those placeholders can be mixed and combined however you want. The framework always tries to load the configured path with all placeholders substituted, when that doesn't find a file, it falls back to .env.
| Placeholder | Type | Description |
|---|---|---|
| environment | string | The currently used Environment. |
| platform | string | The currently used Platform. |
| tenant | string | The currently used Tenant. |
{
...
"project": {
"env": "./new/.env.{platform}.{tenant}.{environment}"
},
...
}