Documentation
Environment Parameters
Environment Parameters
Inject environment variables into service arguments for dynamic runtime configuration.
Using env vars to configure applications is a common practice to make your applications truly dynamic.
To inject this parameters as arguments you need to:
For Example
YAML
services:
foo:
class: ./../foo
arguments: ['%env(NODE_ENV)%']
And then use it in your foo class
class Foo {
constructor (nodeEnv) {
this._env = nodeEnv
}
get env () {
return this._env
}
}
export default Foo
