Skip to main content

Environment Variables

flecks has first-class support for configuring your application through environment variables.

Example

@flecks/core defines a configuration key id. We've already seen how it can be configured like so:

'@flecks/core':
id: 'foobar'

When running your application in different execution environments (say, production) you may want to override configuration such as this. This is done through environment variables:

Syntax

`FLECKS_ENV__${Flecks.environmentalize(fleck)}__${key}`
How do you identify?

As an example, @flecks/core's id key may be set using the following variable:

# Equivalent to above.
FLECKS_ENV__flecks_core__id=foobar
Flecks.environmentalize implementation
  static environmentalize(path) {
return path
// - `@flecks/core` -> `flecks_core`
.replace(/[^a-zA-Z0-9]/g, '_')
.replace(/_*(.*)_*/, '$1');
}

Note that the fleck path and key are still case-sensitive.