Referencing env vars in configs

As mentioned here: https://stackoverflow.com/a/53459699/2111274
This commit is contained in:
Jan Alfred Richter 2018-11-26 08:42:10 +13:00 committed by GitHub
parent 1d9e40ba26
commit 0353b29652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,17 @@ use SilverStripe\Core\Environment;
Environment::setEnv('API_KEY', 'AABBCCDDEEFF012345');
```
### Using environment variables in config
To use environment variables in `.yaml` configs you can reference them using backticks.
```yaml
SilverStripe\Core\Injector\Injector:
MyServiceClass:
properties:
MyProperty: '`ENV_VAR_HERE`'
```
## Including an extra `.env` file
Sometimes it may be useful to include an extra `.env` file - on a shared local development environment where all