> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-flags/use-feature-flags/use-ff/relay-proxy/configuration.md).

# Configuration Reference

### General configuration guidelines <a href="#general-configuration-guidelines" id="general-configuration-guidelines"></a>

The following is general configuration information.

#### Docker container <a href="#docker-container" id="docker-container"></a>

When running the docker container, you must pass configuration as environment variables. This is most commonly done by passing a `.env` file when starting the container.

#### Compiled exe's <a href="#compiled-exes" id="compiled-exes"></a>

When running a compiled exe you can run either passed flags or environment variables.

#### File format for .env <a href="#file-format-for-env" id="file-format-for-env"></a>

The format of the `.env` file is a standard `variable=value` format. See the examples directory for a [sample `.env` file](https://github.com/harness/ff-proxy/tree/main/examples/tls_reverse_proxy/.env)

#### Passing .env file <a href="#passing-env-file" id="passing-env-file"></a>

When running as a docker container the `.env` file can be passed like this:

`docker run -d -p 7000:7000 --env-file .env ff-proxy`

#### Passing flags <a href="#passing-flags" id="passing-flags"></a>

When running the compiled exe's flags can be passed like this:

`./ff-proxy.exe --admin-service-token=${TOKEN} --auth-secret=${SECRET} --account-identifier=${ACCOUNT_IDENTIFIER} --org-identifier=${ORG_IDENTIFIER} --api-keys=${API_KEYS}`

### Configuration options <a href="#configuration-options" id="configuration-options"></a>

#### Required configuration <a href="#required-configuration" id="required-configuration"></a>

When running in online mode, these configuration options are the minimum required to run the relay proxy.

| Environment Variable  | Flag                | Description                                                                                                                           | Type   | Default |
| --------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------- |
| ACCOUNT\_IDENTIFIER   | account-identifier  | An account identifier to load remote config.                                                                                          | string |         |
| ADMIN\_SERVICE\_TOKEN | admin-service-token | Token to use to communicate with the ff service                                                                                       | string |         |
| ORG\_IDENTIFIER       | org-identifier      | An org identifier to load remote config.                                                                                              | string |         |
| API\_KEYS             | api-keys            | API keys to connect with ff-server for each environment. Requires only one server API key per environment in a comma separated string | string |         |

#### Redis cache <a href="#redis-cache" id="redis-cache"></a>

These are the configuration options to connect to redis. Only `REDIS_ADDRESS` is required to connect, the others only need to be set if they differ from the defaults.

| Environment Variable                         | Flag           | Description                                                        | Type   | Default |
| -------------------------------------------- | -------------- | ------------------------------------------------------------------ | ------ | ------- |
| <p>REDIS\_ADDRESS<br><em>(Required)</em></p> | redis-address  | Redis host:port address. See below for info on connecting via TLS  | string |         |
| REDIS\_PASSWORD                              | redis-db       | (Optional) Database to be selected after connecting to the server. | string |         |
| REDIS\_DB                                    | redis-password | (Optional) Redis password.                                         | int    | `0`     |

**Connecting to Redis via TLS:**

To connect to a redis instance that has TLS enabled, you prepend `rediss://` to the beginning of your REDIS\_ADDRESS URL, for example, `rediss://localhost:6379`.

#### Logging <a href="#logging" id="logging"></a>

Control the log level.

| Environment Variable | Flag      | Description                                                            | Type   | Default |
| -------------------- | --------- | ---------------------------------------------------------------------- | ------ | ------- |
| LOG\_LEVEL           | log-level | Controls the log level. Valid options are `INFO`, `DEBUG`, and `ERROR` | string | `INFO`  |

#### Offline mode <a href="#offline-mode" id="offline-mode"></a>

These are the configuration options applicable for running in offline mode

| Environment Variable      | Flag                    | Description                                                                                                    | Type    | Default   |
| ------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------- | ------- | --------- |
| GENERATE\_OFFLINE\_CONFIG | generate-offline-config | if set to true, the proxy produces an offline configuration in the mounted /config directory, then terminates. | boolean | `false`   |
| CONFIG\_DIR               | config-dir              | Specify a path for the offline config directory. The default is /config.                                       | string  | `/config` |
| OFFLINE                   | offline                 | Enables side loading of data from the config directory.                                                        | boolean | `false`   |

#### Port <a href="#port" id="port"></a>

Adjust the port the relay proxy runs on.

| Environment Variable | Flag | Description                                | Type | Default |
| -------------------- | ---- | ------------------------------------------ | ---- | ------- |
| PORT                 | port | Port that the proxy service is exposed on. | int  | `7000`  |

{% hint style="info" %}
**NOTE**

When running the docker container PORT cannot be set to 8000 as it is reserved for an internal service.
{% endhint %}

#### Connection mode between Relay Proxy and Harness SaaS <a href="#connection-mode-between-relay-proxy-and-harness-saas" id="connection-mode-between-relay-proxy-and-harness-saas"></a>

Some corporate networks may be highly restrictive on allowing SSE connections. If you find that the Relay Proxy starts successfully but fails to receive any updates you may want to use these settings to force the Relay Proxy to poll for changes instead of streaming them.

| Environment Variable  | Flag                | Description                                                                                                                               | Type    | Default |
| --------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------- |
| FLAG\_STREAM\_ENABLED | flag-stream-enabled | Specifies whether the proxy connects to Harness in streaming mode to get flag changes. Set to `false` if your network absorbs SSE events. | boolean | `true`  |
| FLAG\_POLL\_INTERVAL  | flag-poll-interval  | How often in seconds the proxy should poll for flag updates (if stream not connected)                                                     | int     | `1`     |

#### Adjust timings <a href="#adjust-timings" id="adjust-timings"></a>

Adjust how often certain actions are performed.

| Environment Variable   | Flag                 | Description                                                                                 | Type | Default |
| ---------------------- | -------------------- | ------------------------------------------------------------------------------------------- | ---- | ------- |
| TARGET\_POLL\_DURATION | target-poll-duration | How often in seconds the proxy polls feature flags for Target changes. Set to 0 to disable. | int  | `60`    |
| METRIC\_POST\_DURATION | metric-post-duration | How often in seconds the proxy posts metrics to Harness. Set to 0 to disable.               | int  | `60`    |
| HEARTBEAT\_INTERVAL    | heartbeat-interval   | How often in seconds the proxy polls pings it's health function. Set to 0 to disable.       | int  | `60`    |

#### TLS <a href="#tls" id="tls"></a>

| Environment Variable | Flag        | Description                                                                     | Type    | Default |
| -------------------- | ----------- | ------------------------------------------------------------------------------- | ------- | ------- |
| TLS\_ENABLED         | tls-enabled | If `true`, the proxy will use the tlsCert and tlsKey to run with https enabled. | boolean | `false` |
| TLS\_CERT            | tls-cert    | Path to TLS cert file. Required if TLS enabled is true.                         | string  |         |
| TLS\_KEY             | tls-key     | Path to TLS key file. Required if TLS enabled is `true`.                        | string  |         |

#### Harness URLs <a href="#harness-urls" id="harness-urls"></a>

You may need to adjust these if you pass all your traffic through a filter or proxy rather than sending the requests directly.

| Environment Variable | Flag           | Description                                 | Type   | Default                                |
| -------------------- | -------------- | ------------------------------------------- | ------ | -------------------------------------- |
| ADMIN\_SERVICE       | admin-service  | URL of the ff admin service                 | string | `https://app.harness.io/gateway/cf`    |
| CLIENT\_SERVICE      | client-service | URL of the ff client service                | string | `https://config.ff.harness.io/api/1.0` |
| METRIC\_SERVICE      | metric-service | URL of the ff metric service                | string | `https://events.ff.harness.io/api/1.0` |
| SDK\_BASE\_URL       | sdk-base-url   | URL for the embedded SDK to connect to      | string | `https://config.ff.harness.io/api/1.0` |
| SDK\_EVENTS\_URL     | sdk-events-url | URL for the embedded SDK to send metrics to | string | `https://events.ff.harness.io/api/1.0` |

#### Auth <a href="#auth" id="auth"></a>

| Environment Variable | Flag        | Description                                                                  | Type    | Default  |
| -------------------- | ----------- | ---------------------------------------------------------------------------- | ------- | -------- |
| BYPASS\_AUTH         | bypass-auth | Bypasses authentication for connecting sdks                                  | boolean | `false`  |
| AUTH\_SECRET         | auth-secret | The secret used for signing the authentication token generated by the Proxy. | string  | `secret` |

#### Development <a href="#development" id="development"></a>

Flags that can help when developing the proxy.

| Environment Variable   | Flag                 | Description                    | Type    | Default |
| ---------------------- | -------------------- | ------------------------------ | ------- | ------- |
| PPROF                  | pprof                | Enables pprof on port 6060     | boolean | `false` |
| GCP\_PROFILER\_ENABLED | gcp-profiler-enabled | Enables the gcp cloud profiler | boolean | `false` |
