Skip to content

EnvironmentParameters

Mauro Gadaleta edited this page Jan 9, 2020 · 1 revision

Environment Parameters

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 = env
  }

  get env () {
    return this._env
  }
}

export default Foo