---
title: Agent advanced configuration
slug: feature-experimentation/docs/advanced-configuration
createdAt: 2026-08-05T20:40:00.000Z
---

Configuration can be provided to Optimizely Agent through the following methods:

- Reading from environment variables.
- Reading from a YAML configuration file.

:::hint{type="info"}
**Note**
When a configuration option is specified through both methods, environment variables take precedence over the config file.
:::

Internally, Optimizely Agent uses the [Viper](https://github.com/spf13/viper) library's support for configuration files and environment variables.

## Config file location

The default location of the config file is `config.yaml` in the root directory. If you want to specify another location, use the `OPTIMIZELY_CONFIG_FILENAME` environment variable.

```shell
OPTIMIZELY_CONFIG_FILENAME=/path/to/other_config_file.yaml make run
```

## Nested configuration options

When setting the value of "nested" configuration options using environment variables, underscores denote deeper access. The following examples are equivalent ways of setting the client polling interval:

- Set the polling interval in YAML

```yaml
# Setting a nested value in a .yaml file:
client:
    pollingInterval: 120s
```

- Set the polling interval with a shell script

```shell
# Set environment variable for pollingInterval, nested inside client
export OPTIMIZELY_CLIENT_POLLINGINTERVAL=120s
```

## Unsupported environment variable options

The following options can only be configured through a config file and not environment variables:

- `admin.auth.clients`
- `api.auth.clients`
- Options under `webhook.projects`

For details on these options, see the Configuration Options table in the [Agent GitHub Readme](https://github.com/optimizely/agent/blob/master/README.md#configuration-options).
