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

# Feature Toggles

> Turn on integrations that 2501 releases in steps, and Elasticsearch logging

Feature toggles turn on, for the whole installation, an integration that 2501 releases in steps. They are not where you turn on a paid feature or a setting: the [license](https://docs.2501.ai/0.23/configure/licensing.md) sets those. Toggles live in the `FeatureToggle` table of the 2501 database, one row per key. Each time it starts, the engine writes a row for every key below that has none, and deletes the rows of keys it no longer knows.

## Rollout toggles

Set the gateway toggles under `rolloutToggles` in `values.yaml`. A change restarts the engine, which writes the ones you set to the database at each start. A toggle you leave out keeps its value in the database, and is off on a new installation. A toggle you set back to `false` turns off when you apply or upgrade, whichever way you deploy. A toggle you set there comes back at every engine start, a crash or a node drain included, over a change on the Feature toggles page: to manage a toggle on that page, leave it out of `rolloutToggles`.

On Docker Swarm, the published `compose.yaml` holds the rollout toggles, and you change only `.env` and `site.yaml`. Change a gateway toggle in the database instead, as below.

```yaml theme={null}
rolloutToggles:
  # ecritelGateway: true
  easyvistaGateway: true
```

| Value | Toggle key | Turns on |
| - | - | - |
| `ecritelGateway` | `gateways.allow_ecritel_type` | The Ecritel gateway: its type in the create form, and the polling that opens tickets |
| `easyvistaGateway` | `gateways.allow_easyvista_type` | The EasyVista gateway: its type in the create form, and the polling that reads tickets |

The next upgrade overwrites a database change to a toggle that `values.yaml` sets.

## Other toggles

These toggles are changed in the database:

| Toggle key | Turns on | Default |
| - | - | - |
| `enableElasticSearch` | Shipping the engine logs to Elasticsearch. The first run turns it on when `elasticsearch.mode` is not `none`. | Off |

### Paid features before a license lists them

An installation upgraded from an earlier version may still run on a license signed before paid features existed, or have a tenant with no license. While that license is valid, or while the tenant has no license, each paid feature follows its toggle: `enableDiscovery`, `enableObservability`, `enableCentral`, `enableSatelliteClusters`, `enablePrivilegedAccess` and `enableSingleSignOn`. The engine reads them at start. A license that lists paid features, or an expired license, makes these toggles have no effect. Ask 2501 for a license with your paid features before the next version, which removes them.

## Open a database session

With the PostgreSQL 2501 deploys on Kubernetes:

```bash theme={null}
kubectl -n "$NS" exec -i deploy/postgres -- psql -U 2501 -d 2501
```

On Docker Swarm, with `$STACK` the name you deployed the stack with (`ai-2501` in [Deploy](https://docs.2501.ai/0.23/deployment/docker-swarm.md#deploy)):

```bash theme={null}
docker exec -i "$(docker ps -q -f "label=com.docker.swarm.service.name=${STACK}_postgres")" psql -U 2501 -d 2501
```

With your own PostgreSQL, connect with the `DIRECT_URL` from `env.engine`:

```bash theme={null}
psql "$DIRECT_URL"
```

## Change a toggle

```sql theme={null}
-- Every toggle and its state
SELECT key, enabled, description FROM "FeatureToggle" ORDER BY key;

-- Turn one on (set false to turn it off)
UPDATE "FeatureToggle" SET enabled = true, updated_at = now() WHERE key = '<key>';
```

The engine reads the gateway toggles again every 20 seconds. It reads the other toggles when it starts: restart it to apply a change, with `kubectl -n "$NS" rollout restart deploy/engine` or `docker service update --force "${STACK}_engine"`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.