--- title: Environment Variables description: Configure your application with environment variables. --- # 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: ```yml '@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 by using the a prefix followed by the fleck name and the key. The template literal for such a transformation would look like: ### Syntax ```javascript `FLECKS_ENV__${Flecks.environmentalize(path)}__${key}` ``` :::note Notice the `environmentalize` transformation: `@flecks/core`'s `id` key is set using the following variable: ```bash FLECKS_ENV__flecks_core__id=foobar ```
`Flecks.environmentalize` ```javascript static environmentalize(path) { return path // - `@flecks/core` -> `FLECKS_CORE` .replace(/[^a-zA-Z0-9]/g, '_') .replace(/_*(.*)_*/, '$1'); } ```
Also note that the fleck path and key are still case-sensitive. This is because they are user-defined. :::