Project: GO Feature Flag (Observability and Analysis / Feature Flagging)
File: configure_relay_proxy.md

sidebar_position: 30 description: How to configure the relay proxy to serve your feature flags. The configuration of the relay proxy is based on a configuration file that you have to provide. :::tip Use environment variables. You can also override these file configuration by using environment variables. Note that all environment variables should be uppercase. If you want to replace a nested fields, please use `` to separate each field (ex: `RETRIEVERKIND`). ::: | Field name | Type | Default | Description | |||-|--| | `retriever` | | none | (mandatory) This is the configuration on how to retrieve the configuration of the files.<br /><br />Note: this field is mandatory only if `retrievers` is not set. | | | `retrievers` | | none | (mandatory) Exactly the same things as `retriever` except that you can provide more than 1 retriever.<br /><br />Note: this field is mandatory only if `retriever` is not set. | | `listen` | int | `1031` | This is the port used by the relay proxy when starting the HTTP server. | | `pollingInterval` | int | `60000` | This is the time interval in millisecond when the relay proxy is reloading the configuration file.<br/>The minimum time accepted is 1000 millisecond. | | `hideBanner` | boolean | `false` | Should we display the beautiful go-feature-flag banner when starting the relay proxy | | `enableSwagger` | boolean | `false` | Do you want to enable swagger to test the APIs directly. If you are enabling Swagger you will have to provide the `host` configuration and the Swagger UI will be available at `http://<host>:<listen>/swagger/`. | | `host` | string | `localhost` | This is the DNS you will use to access the relay proxy. This field is used by Swagger to query the API at the right place. | | `restApiTimeout` | int | `5000` | Timeout in millisecond we are accepting to wait in our APIs. | | `debug` | boolean | `false` | If `true` you will have more logs in the output that will help you to better understand what happen. If an error happen in the API the error will be also shown in the body. | | `fileFormat` | string | `yaml` | This is the format of your `go-feature-flag` configuration file. Acceptable values are `yaml`, `json`, `toml`. | | `startWithRetrieverError` | boolean | `false` | By default the relay proxy will crash if he is not able to retrieve the flags from the configuration.<br/>If you don't want your relay proxy to crash, you can set `startWithRetrieverError` to true. Until the flag is retrievable the relay proxy will only answer with default values. | | `exporter` | | none | Exporter is the configuration on how to export data. | | `notifier` | | none | Notifiers is the configuration on where to notify a flag change. | | `apiKeys` | []string | none | List of authorized API keys. Each request will need to provide one of authorized key inside `Authorization` header with format `Bearer <api-key>`.<br /><br />Note: there will be no authorization when this config is not set. | <a name="retriever"></a> `go-feature-flag` is supporting different kind of retriever such as S3, Google store, etc ... In this section we will present all the available retriever configuration available. | Field name | Type | Default | Description | ||--|-|--| | `kind` | string | none | (mandatory) Value should be

field is mandatory and describe which retriever you are using. | | `bucket` | string | none | (mandatory) This is the name of your S3 bucket (ex: `my-featureflag-bucket`). | | `item` | string | none | (mandatory) Path to the file inside the bucket (ex: `config/flag/my-flags.yaml`). | | Field name | Type | Default | Description | ||--|-|| | `kind` | string | none | (mandatory) Value should be `github`.<br/>This field is mandatory and describe which retriever you are using. | | `repositorySlug` | string | none | (mandatory) The repository slug of the GitHub repository where your file is located (ex: `thomaspoignant/go-feature-flag`). | | `path` | string | none | (mandatory) Path to the file inside the repository (ex: `config/flag/my-flags.yaml`). | | `branch` | string | `main` | The branch we should check in the repository. | | `githubToken` | string | none | Github token is used to access a private repository, you need the repo permission (). | | `timeout` | string | `10000` | Timeout in millisecond used when calling GitHub. | | Field name | Type | Default | Description | ||--|-|-| | `kind` | string | none | (mandatory) Value should be `file`.<br/>This field is mandatory and describe which retriever you are using. | | `path` | string | none | (mandatory) Path to the file in your local computer (ex: `/goff/my-flags.yaml`). | | Field name | Type | Default | Description | |||-|-| | `kind` | string | none | (mandatory) Value should be `http`.<br/>This field is mandatory and describe which retriever you are using. | | `url` | string | none | (mandatory) Location where to retrieve the file. | | `method` | string | `GET` | The HTTP Method you are using to call the HTTP endpoint. | | `body` | string | none | The HTTP Body you are using to call the HTTP endpoint. | | `headers` | mapstring | none | The HTTP headers used to call when calling the HTTP endpoint (useful for authorization). | | `timeout` | string | `10000` | Timeout in millisecond used when calling the HTTP endpoint. | | Field name | Type | Default | Description | ||--|-|-| | `kind` | string | none | (mandatory) Value should be `googleStorage`.<br/>This field is mandatory and describe which retriever you are using. | | `bucket` | string | none | (mandatory) This is the name of your Google Storage bucket (ex: `my-featureflag-bucket`). | | `object` | string | none | (mandatory) Path to the file inside the bucket (ex: `config/flag/my-flags.yaml`). | Note that relay proxy is only supporting this while running inside the kubernetes cluster. | Field name | Type | Default | Description | |-|--|-|| | `kind` | string | none | (mandatory) Value should be `configmap`.<br/>This field is mandatory and describe which retriever you are using. | | `namespace` | string | none | (mandatory) This is the name of the namespace where your configmap is located (ex: `default`). | | `configmap` | string | none | (mandatory) Name of the configmap we should read (ex: `feature-flag`). | | `key` | string | none | (mandatory) Name of the `key` in the configmap which contains the flag. | <a name="exporter"></a> | Field name | Type | Default | Description | |--|-|-|-| | `kind` | string | none | (mandatory) Value should be `webhook`.<br/>This field is mandatory and describe which retriever you are

| | `endpointUrl` | string | none | (mandatory) EndpointURL of your webhook. | | `flushInterval` | int | `60000` | The interval in millisecond between 2 calls to the webhook (if the `maxEventInMemory` is reached before the flushInterval we will call the webhook before). | | `maxEventInMemory` | int | `100000` | If we hit that limit we will call the webhook. | | `secret` | string | none | Secret used to sign your request body and fill the `X-Hub-Signature-256` header.<br/> See for more details. | | `meta` | map[string]string | none | Add all the information you want to see in your request. | | Field name | Type | Default | Description | |--|--|--|| | `kind` | string | none | (mandatory) Value should be `file`.<br/>This field is mandatory and describe which retriever you are using. | | `outputDir` | string | none | (mandatory) OutputDir is the location of the directory where to store the exported files. It should finish with a `/`. | | `flushInterval` | int | `60000` | The interval in millisecond between 2 calls to the webhook (if the `maxEventInMemory` is reached before the flushInterval we will call the webhook before). | | `maxEventInMemory` | int | `100000` | If we hit that limit we will call the webhook. | | `format` | string | `JSON` | Format is the output format you want in your exported file. Available format: `JSON`, `CSV`, `Parquet`. | | `filename` | string | `flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}` | You can use a templated config to define the name of your exported files. Available replacement are `{{ .Hostname}}`, `{{ .Timestamp}}` and `{{ .Format}` | | `csvTemplate` | string | `{{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};{{ .Value}};{{ .Default}}\n` | CsvTemplate is used if your output format is CSV.<br/>This field will be ignored if you are using another format than CSV.<br/>You can decide which fields you want in your CSV line with a go-template syntax, please check to see what are the fields available. |` | `parquetCompressionCodec` | string | `SNAPPY` | ParquetCompressionCodec is the parquet compression codec for better space efficiency. |` | Field name | Type | Default | Description | |--|--|-|-| | `kind` | string | none | (mandatory) Value should be `log`.<br/>This field is mandatory and describe which retriever you are using. | | `flushInterval` | int | `60000` | The interval in millisecond between 2 calls to the webhook (if the `maxEventInMemory` is reached before the flushInterval we will call the webhook before). | | `maxEventInMemory` | int | `100000` | If we hit that limit we will call the webhook. | | `logFormat` | string | ` configuration of the output format of your log.<br/>You can use all the key from the exporter.FeatureEvent + a key called FormattedDate that represent the date with the RFC 3339 Format. | | Field name | Type | Default | Description | |--|--|--|| | `kind` | string | none | (mandatory) Value should be `s3`.<br/>This field is mandatory and describe which retriever you are using. | | `bucket` | string | none | (mandatory) Name of your S3 Bucket. | | `flushInterval` | int | `60000` | The interval in millisecond between 2 calls to the webhook (if the `maxEventInMemory` is reached before the flushInterval we will call the webhook

| | `maxEventInMemory` | int | `100000` | If we hit that limit we will call the webhook. | | `format` | string | `JSON` | Format is the output format you want in your exported file. Available format: `JSON`, `CSV`, `Parquet`. | | `filename` | string | `flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}` | You can use a templated config to define the name of your exported files. Available replacement are `{{ .Hostname}}`, `{{ .Timestamp}}` and `{{ .Format}` | | `csvTemplate` | string | `{{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};{{ .Value}};{{ .Default}}\n` | CsvTemplate is used if your output format is CSV.<br/>This field will be ignored if you are using another format than CSV.<br/>You can decide which fields you want in your CSV line with a go-template syntax, please check to see what are the fields available. |` | `path` | string | bucket root level | The location of the directory in S3. | | `parquetCompressionCodec` | string | `SNAPPY` | ParquetCompressionCodec is the parquet compression codec for better space efficiency. |` | Field name | Type | Default | Description | |--|--|--|| | `kind` | string | none | (mandatory) Value should be `s3`.<br/>This field is mandatory and describe which retriever you are using. | | `bucket` | string | none | (mandatory) Name of your Google Cloud Storage Bucket. | | `flushInterval` | int | `60000` | The interval in millisecond between 2 calls to the webhook (if the `maxEventInMemory` is reached before the flushInterval we will call the webhook before). | | `maxEventInMemory` | int | `100000` | If we hit that limit we will call the webhook. | | `format` | string | `JSON` | Format is the output format you want in your exported file. Available format: `JSON`, `CSV`, `Parquet`. | | `filename` | string | `flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}` | You can use a templated config to define the name of your exported files. Available replacement are `{{ .Hostname}}`, `{{ .Timestamp}}` and `{{ .Format}` | | `csvTemplate` | string | `{{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};{{ .Value}};{{ .Default}}\n` | CsvTemplate is used if your output format is CSV.<br/>This field will be ignored if you are using another format than CSV.<br/>You can decide which fields you want in your CSV line with a go-template syntax, please check to see what are the fields available. |` | `path` | string | bucket root level | The location of the directory in S3. | | `parquetCompressionCodec` | string | `SNAPPY` | ParquetCompressionCodec is the parquet compression codec for better space efficiency. |` <a name="notifier"></a> | Field name | Type | Default | Description | |-|--|-|--| | `kind` | string | none | (mandatory) Value should be `slack`.<br/>This field is mandatory and describe which retriever you are using. | | `slackWebhookUrl` | string | none | (mandatory) The complete URL of your incoming webhook configured in Slack. | | Field name | Type | Default | Description | |-|||-| | `kind` | string | none | (mandatory) Value should be `slack`.<br/>This field is mandatory and describe which retriever you are using. | | `endpointUrl` | string | none | (mandatory) The complete URL of your API (we will send a POST request to this URL, see | | `secret` | string | none | Secret used to sign your request body and fill the `X-Hub-Signature-256` header.<br/> See for more details. | | `meta` | map[string]string | none | Add all the information you want to see in your request. |