# Environment variable configs

(Applies to dbt v1.11 and later)

Environment variables use the `DBT_ENGINE_` prefix. For a list of all dbt environment variables you can set, refer to [Available flags](./about-global-configs.md#available-flags).

Env var

```text

$ export DBT_ENGINE_<THIS-CONFIG>=True
dbt run
```

For more detailed information, read our [environment variables page](../../docs/build/environment-variables.md).

## Config precedence

There are multiple ways of setting flags, which depend on the use case:

* **[CLI options](./command-line-options.md):** Define behavior specific to *this invocation*. Supported for all dbt commands.
* **[Environment variables](./environment-variable-configs.md):** Define different behavior in different runtime environments (development vs. production vs. [continuous integration](../../docs/deploy/continuous-integration.md)), or different behavior for different users in development (based on personal preferences).
* **[Project-level `flags` in `dbt_project.yml`](./project-flags.md):** Define version-controlled defaults for everyone running this project. Also, opt in or out of [behavior changes](./behavior-changes.md) to manage your migration off legacy functionality.
* **[User settings (`~/.dbt/user_settings.yml`)](./user-settings.md):** Define personal preferences that apply across all projects on your machine. Written automatically by `dbt login`.

The most specific setting "wins." CLI options take the highest precedence, followed by environment variables, then `dbt_project.yml`, and finally `user_settings.yml`. If you set the flag in none of those places, it will use the default value defined within dbt.

Most flags can be set in all three places:

```yaml
# dbt_project.yml
flags:
  # set default for running this project -- anywhere, anytime, by anyone
  fail_fast: true
```

(Applies to dbt v1.11 and later)

```bash
# set this environment variable to 'True' (bash syntax)
export DBT_ENGINE_FAIL_FAST=1
dbt run
```

```bash
dbt run --fail-fast # set to True for this specific invocation
dbt run --no-fail-fast # set to False
```

There are two categories of exceptions:

1. **Flags setting file paths:** Flags for file paths that are relevant to runtime execution (for example, `--log-path` or `--state`) cannot be set in `dbt_project.yml`. To override defaults, pass CLI options or set environment variables ((Applies to dbt v1.11 and later) `DBT_ENGINE_LOG_PATH` and `DBT_ENGINE_STATE`). Flags that tell dbt where to find project resources (for example, `model-paths`) are set in `dbt_project.yml`, but as a top-level key, outside the `flags` dictionary; these configs are expected to be fully static and never vary based on the command or execution environment.
2. **Opt-in flags:** Flags opting in or out of [behavior changes](./behavior-changes.md) can *only* be defined in `dbt_project.yml`. These are intended to be set in version control and migrated via pull/merge request. Their values should not diverge indefinitely across invocations, environments, or users.

## Was this page helpful?

YesNo

[Privacy policy](https://www.getdbt.com/cloud/privacy-policy)[Create a GitHub issue](https://github.com/dbt-labs/docs.getdbt.com/issues)

This site is protected by reCAPTCHA and the Google [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.
