---
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 like so:

### Syntax

```javascript
`FLECKS_ENV__${Flecks.environmentalize(fleck)}__${key}`
```

:::tip[How do you identify?]

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

```bash
FLECKS_ENV__flecks_core__id=foobar
```

<details>
  <summary>`Flecks.environmentalize` implementation</summary>
  ```javascript
    static environmentalize(path) {
      return path
        // - `@flecks/core` -> `flecks_core`
        .replace(/[^a-zA-Z0-9]/g, '_')
        .replace(/_*(.*)_*/, '$1');
    }
  ```
</details>

Note that the fleck path and key are still case-sensitive. This is because they are
user-defined.

:::
