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

# Configuration

> Customizing Swiftgum for cloud or on-prem usage.

Swiftgum requires very little setup in the **cloud** environment: typically, you only need an **API key**. If you choose to run Swiftgum **on-prem**, you can customize environment variables and settings for your local deployment.

## 1. Cloud Configuration

For most teams using **Swiftgum Cloud**:

* **No Environment Variables**: Simply include your `x-api-key` in the header when calling Swiftgum’s API (e.g., `https://api.swiftgum.com`).
* **Dashboard Settings**: Manage provider credentials (like Google OAuth secrets) and advanced configurations directly in the Swiftgum admin UI.

Tip: If you need to rotate your API key, do so from the Swiftgum Cloud dashboard. Make sure to update your applications accordingly.

## 2. On-Prem Environment Variables

If you have an **on-prem** Swiftgum license, you can set the following environment variables to tailor your deployment:

| Variable          | Required | Description                                                                                             |
| ----------------- | -------- | ------------------------------------------------------------------------------------------------------- |
| `DATABASE_URL`    | Optional | If self-hosting with Postgres/SQLite, specify the DB connection string.                                 |
| `ENCRYPTION_KEY`  | Optional | Used for encrypting credentials at rest. If not provided, a default is used (not recommended for prod). |
| `PORT`            | Optional | The local port Swiftgum listens on (e.g., `3000`).                                                      |
| `LOG_LEVEL`       | Optional | Set to `info`, `warn`, `error`, or `debug` for logging verbosity.                                       |
| `SESSION_TIMEOUT` | Optional | How long a portal session remains valid (e.g., 3600 for one hour).                                      |
| `COOKIE_SECRET`   | Optional | Used to sign session cookies if running Swiftgum behind a custom domain.                                |

### Example `.env`

DATABASE\_URL=postgres\://user:password\@localhost:5432/swiftgum
ENCRYPTION\_KEY=something-secure
PORT=3000
LOG\_LEVEL=info
SESSION\_TIMEOUT=3600
COOKIE\_SECRET=my\_cookie\_secret

Avoid committing your `.env` file to source control. Use secure secret management (e.g., GitHub Actions secrets, AWS Parameter Store).

## 3. Additional Settings

### Provider Credentials

If using OAuth integrations (e.g., Google Drive), store client IDs/secrets in environment variables or a secrets manager. Then reference them in Swiftgum’s admin UI under **Integrations**.

### Debug & Logging

* **LOG\_LEVEL**: Change verbosity (`info`, `warn`, `error`, or `debug`).
* **ENABLE\_DEBUG**: For more verbose logs, set this to `true`.

### Session & Portal

* **SESSION\_TIMEOUT**: Dictates how long a portal session is valid.
* **COOKIE\_SECRET**: If running behind a custom domain, helps sign session cookies securely.

## 4. Testing Your Configuration

### 4.1 On-Prem

* **Spin up Swiftgum**: Run via Docker Compose or your custom deployment.
* **Check Logs**: Look for any missing variables or config errors.
* **Access Admin UI**: Visit `http://localhost:3000/admin` (or your chosen port) and log in with your admin credentials.

### 4.2 Cloud

* **Dashboard Confirmation**: Use the Swiftgum Cloud dashboard to confirm that your integrations, OAuth credentials, and advanced settings are correct.
* **API Calls**: Verify that your `x-api-key` is working by calling the Portal Session endpoint.

With these configurations in place, you’re ready to manage integrations, tokens, and user sessions confidently.
