> ## Documentation Index
> Fetch the complete documentation index at: https://docs.strata.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment Variable Substitution

Environment variable substitution allows you to reference host environment variables inside YAML configuration files using the `{{ env.VAR }}` syntax. Values are resolved at configuration load time regardless of which config source is used.

<Note>
  **Console terminology:** In the Maverics Console, Orchestrator instances and
  configuration delivery are managed through **Deployments**. When working directly
  with YAML, configuration is managed as files delivered via the `-config` flag or
  `MAVERICS_CONFIG` environment variable.
</Note>

## Overview

The `{{ env.VAR }}` syntax lets you externalize sensitive values and deployment-specific settings from your YAML configuration. This works with any config source -- local file, S3, GitHub, or any other remote source. The Orchestrator replaces `{{ env.VAR }}` with the value of the named environment variable when loading configuration.

<Note>
  Environment variable substitution works with any config source. The `{{ env.VAR }}` syntax is resolved at configuration load time regardless of whether the config comes from a local file, S3, GitHub, or any other source.
</Note>

## Use Cases

* **Container deployments** -- inject deployment-specific values (client IDs, tenant IDs, hostnames) via Kubernetes ConfigMaps or Docker environment variables
* **CI/CD pipelines** -- set deployment-specific values during automated builds without modifying base configuration files
* **Secret injection** -- reference credentials set in the environment rather than hardcoding them in YAML (for production, use a [secret provider](/reference/orchestrator/configuration/secret-providers) instead)

## Configuration

Reference environment variables in your YAML configuration using the `{{ env.VAR_NAME }}` syntax (spaces inside braces are optional):

```yaml theme={null}
# In maverics.yaml, reference environment variables:
connectors:
  - name: azure
    type: azure
    oauthClientID: "{{ env.AZURE_CLIENT_ID }}"
    oidcWellKnownURL: "https://login.microsoftonline.com/{{ env.AZURE_TENANT_ID }}/v2.0/.well-known/openid-configuration"
    oauthClientSecret: "{{ env.AZURE_CLIENT_SECRET }}"

http:
  address: "{{ env.LISTEN_ADDRESS }}"
```

Set the environment variables before starting the Orchestrator:

```bash theme={null}
# Set the environment variables
export AZURE_CLIENT_ID="my-client-id"
export AZURE_TENANT_ID="my-tenant-id"
export AZURE_CLIENT_SECRET="my-client-secret"
export LISTEN_ADDRESS="0.0.0.0:9443"

# Start the Orchestrator
maverics -config maverics.yaml
```

Lines starting with `#` (YAML comments) are not processed for substitution.

## Syntax Reference

| Syntax               | Description                                              |
| -------------------- | -------------------------------------------------------- |
| `{{ env.VAR_NAME }}` | Substitutes the value of `VAR_NAME` from the environment |
| `{{env.VAR_NAME}}`   | Also valid -- spaces inside braces are optional          |

The substitution happens at configuration load time. If the referenced environment variable is not set, the Orchestrator will use an empty string.

## Troubleshooting

* **Empty values at runtime** -- verify the environment variable is set in the same shell or process where the Orchestrator runs. Use `printenv VAR_NAME` to confirm.
* **Substitution not working** -- check that the syntax uses `env.` prefix (not just the variable name). The correct format is `{{ env.MY_VAR }}`, not `{{ MY_VAR }}` or `$MY_VAR`.
* **Values with special characters** -- wrap the substitution in quotes in YAML to prevent parsing issues: `"{{ env.MY_VAR }}"`.

## Related Pages

<CardGroup cols={2}>
  <Card title="Config Sources" icon="folder-gear" href="/reference/orchestrator/configuration/config-sources">
    Overview of all configuration sources
  </Card>

  <Card title="File" icon="file" href="/reference/orchestrator/configuration/config-sources/file">
    Load config from a local YAML file
  </Card>

  <Card title="Secret Providers" icon="vault" href="/reference/orchestrator/configuration/secret-providers">
    Secure secret injection via dedicated secret providers
  </Card>
</CardGroup>
