Merge pull request #8633 from falnyr/patch-1

Referencing env vars in configs
This commit is contained in:
Guy Marriott 2018-11-27 09:43:47 +13:00 committed by GitHub
commit 1b68157e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,22 @@ 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`'
```
<div class="info">
<p>Environment variables cannot be used outside of Injector config as of version 4.2.</p>
</div>
## Including an extra `.env` file
Sometimes it may be useful to include an extra `.env` file - on a shared local development environment where all