> ## Documentation Index
> Fetch the complete documentation index at: https://sourcebot-whoisthey-language-model-input-modalities.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment variables

<Note>This page provides a detailed reference of all environment variables supported by Sourcebot. If you're just looking to get up and running, we recommend starting with the [deployment guides](/docs/deployment/docker-compose) instead.</Note>

### Core Environment Variables

The following environment variables allow you to configure your Sourcebot deployment.

| Variable                                       | Default                | Description                                                                                                                                                                                                                                                                                                                                                              |
| :--------------------------------------------- | :--------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AUTH_SECRET` **(required)**                   | -                      | <p>Used to validate login session cookies. Genearte one with `openssl rand -base64 33`.</p>                                                                                                                                                                                                                                                                              |
| `AUTH_SESSION_MAX_AGE_SECONDS`                 | `2592000` (30 days)    | <p>Relative time from now in seconds when to expire the session.</p>                                                                                                                                                                                                                                                                                                     |
| `AUTH_SESSION_UPDATE_AGE_SECONDS`              | `86400` (1 day)        | <p>How often the session should be updated in seconds. If set to `0`, session is updated every time.</p>                                                                                                                                                                                                                                                                 |
| `OAUTH_AUTHORIZATION_CODE_TTL_SECONDS`         | `600` (10 minutes)     | <p>Lifetime of an OAuth authorization code, in seconds.</p>                                                                                                                                                                                                                                                                                                              |
| `OAUTH_ACCESS_TOKEN_TTL_SECONDS`               | `3600` (1 hour)        | <p>Lifetime of an OAuth access token, in seconds.</p>                                                                                                                                                                                                                                                                                                                    |
| `OAUTH_REFRESH_TOKEN_TTL_SECONDS`              | `7776000` (90 days)    | <p>Lifetime of an OAuth refresh token, in seconds.</p>                                                                                                                                                                                                                                                                                                                   |
| `AUTH_URL`                                     | -                      | <p>URL of your Sourcebot deployment, e.g., `https://example.com` or `http://localhost:3000`.</p>                                                                                                                                                                                                                                                                         |
| `CONFIG_PATH`                                  | `-`                    | <p>The container relative path to the declarative configuration file. See [this doc](/docs/configuration/declarative-config) for more info.</p>                                                                                                                                                                                                                          |
| `DATA_CACHE_DIR`                               | `$DATA_DIR/.sourcebot` | <p>The root data directory in which all data written to disk by Sourcebot will be located.</p>                                                                                                                                                                                                                                                                           |
| `DATA_DIR`                                     | `/data`                | <p>The directory within the container to store all persistent data. Typically, this directory will be volume mapped such that data is persisted across container restarts (e.g., `docker run -v $(pwd):/data`)</p>                                                                                                                                                       |
| `DATABASE_URL` **(required)**                  | -                      | <p>Connection string of your Postgres database, e.g. `postgresql://user:password@host:5432/sourcebot`.</p><p>If you'd like to use a non-default schema, you can provide it as a parameter in the database url.</p><p>You can also use `DATABASE_HOST`, `DATABASE_USERNAME`, `DATABASE_PASSWORD`, `DATABASE_NAME`, and `DATABASE_ARGS` to construct the database url.</p> |
| `EMAIL_FROM_ADDRESS`                           | `-`                    | <p>The email address that transactional emails will be sent from. See [this doc](/docs/configuration/transactional-emails) for more info.</p>                                                                                                                                                                                                                            |
| `REDIS_URL` **(required)**                     | -                      | <p>Connection string of your Redis instance, e.g. `redis://host:6379`.</p><p>To enable TLS, see [this doc](/docs/deployment/infrastructure/redis#tls).</p>                                                                                                                                                                                                               |
| `REDIS_REMOVE_ON_COMPLETE`                     | `0`                    | <p>Controls how many completed jobs are allowed to remain in Redis queues</p>                                                                                                                                                                                                                                                                                            |
| `REDIS_REMOVE_ON_FAIL`                         | `100`                  | <p>Controls how many failed jobs are allowed to remain in Redis queues</p>                                                                                                                                                                                                                                                                                               |
| `REPO_SYNC_RETRY_BASE_SLEEP_SECONDS`           | `60`                   | <p>The base sleep duration (in seconds) for exponential backoff when retrying repository sync operations that fail</p>                                                                                                                                                                                                                                                   |
| `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS`          | `600`                  | <p>The timeout duration (in seconds) for GitLab client queries</p>                                                                                                                                                                                                                                                                                                       |
| `SMTP_CONNECTION_URL`                          | `-`                    | <p>The url to the SMTP service used for sending transactional emails. See [this doc](/docs/configuration/transactional-emails) for more info.</p><p>You can also use `SMTP_HOST`, `SMTP_PORT`, `SMTP_USERNAME`, and `SMTP_PASSWORD` to construct the SMTP connection url.</p>                                                                                            |
| `SMTP_HOST`                                    | `-`                    | <p>The hostname of the SMTP server. Used to construct `SMTP_CONNECTION_URL` when individual SMTP variables are provided.</p>                                                                                                                                                                                                                                             |
| `SMTP_PORT`                                    | `-`                    | <p>The port of the SMTP server.</p>                                                                                                                                                                                                                                                                                                                                      |
| `SMTP_USERNAME`                                | `-`                    | <p>The username for SMTP authentication.</p>                                                                                                                                                                                                                                                                                                                             |
| `SMTP_PASSWORD`                                | `-`                    | <p>The password for SMTP authentication.</p>                                                                                                                                                                                                                                                                                                                             |
| `SOURCEBOT_ENCRYPTION_KEY` **(required)**      | -                      | <p>Used to encrypt connection secrets and generate API keys. Generate one with `openssl rand -base64 24`.</p>                                                                                                                                                                                                                                                            |
| `SOURCEBOT_PUBLIC_KEY_PATH`                    | `/app/public.pem`      | <p>Sourcebot's public key that's used to verify encrypted license key signatures.</p>                                                                                                                                                                                                                                                                                    |
| `SOURCEBOT_LOG_LEVEL`                          | `info`                 | <p>The Sourcebot logging level. Valid values are `debug`, `info`, `warn`, `error`, in order of severity.</p>                                                                                                                                                                                                                                                             |
| `SOURCEBOT_STRUCTURED_LOGGING_ENABLED`         | `false`                | <p>Enables/disable structured JSON logging. See [this doc](/docs/configuration/structured-logging) for more info.</p>                                                                                                                                                                                                                                                    |
| `SOURCEBOT_STRUCTURED_LOGGING_FILE`            | -                      | <p>Optional file to log to if structured logging is enabled</p>                                                                                                                                                                                                                                                                                                          |
| `SOURCEBOT_TELEMETRY_DISABLED`                 | `false`                | <p>Enables/disables telemetry collection in Sourcebot. See [this doc](/docs/misc/telemetry) for more info.</p>                                                                                                                                                                                                                                                           |
| `DEFAULT_MAX_MATCH_COUNT`                      | `10000`                | <p>The default maximum number of search results to return when using search in the web app.</p>                                                                                                                                                                                                                                                                          |
| `ALWAYS_INDEX_FILE_PATTERNS`                   | -                      | <p>A comma separated list of glob patterns matching file paths that should always be indexed, regardless of size or number of trigrams.</p>                                                                                                                                                                                                                              |
| `NODE_USE_ENV_PROXY`                           | `0`                    | <p>Enables Node.js to automatically use `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` environment variables for network requests. Set to `1` to enable or `0` to disable. See [this doc](https://nodejs.org/en/learn/http/enterprise-network-configuration) for more info.</p>                                                                                             |
| `HTTP_PROXY`                                   | -                      | <p>HTTP proxy URL for routing non-SSL requests through a proxy server (e.g., `http://proxy.company.com:8080`). Requires `NODE_USE_ENV_PROXY=1`.</p>                                                                                                                                                                                                                      |
| `HTTPS_PROXY`                                  | -                      | <p>HTTPS proxy URL for routing SSL requests through a proxy server (e.g., `http://proxy.company.com:8080`). Requires `NODE_USE_ENV_PROXY=1`.</p>                                                                                                                                                                                                                         |
| `NO_PROXY`                                     | -                      | <p>Comma-separated list of hostnames or domains that should bypass the proxy (e.g., `localhost,127.0.0.1,.internal.domain`). Requires `NODE_USE_ENV_PROXY=1`.</p>                                                                                                                                                                                                        |
| `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED`           | `true`                 | <p>Enables/disables audit logging</p>                                                                                                                                                                                                                                                                                                                                    |
| `SOURCEBOT_EE_AUDIT_RETENTION_DAYS`            | `180`                  | <p>The number of days to retain audit logs. Audit log records older than this will be automatically pruned daily. Set to `0` to disable pruning and retain logs indefinitely.</p>                                                                                                                                                                                        |
| `AUTH_EE_GCP_IAP_ENABLED`                      | `false`                | <p>When enabled, allows Sourcebot to automatically register/login from a successful GCP IAP redirect</p>                                                                                                                                                                                                                                                                 |
| `AUTH_EE_GCP_IAP_AUDIENCE`                     | -                      | <p>The GCP IAP audience to use when verifying JWT tokens. Must be set to enable GCP IAP JIT provisioning</p>                                                                                                                                                                                                                                                             |
| `PERMISSION_SYNC_ENABLED`                      | `false`                | <p>Enables [permission syncing](/docs/features/permission-syncing).</p>                                                                                                                                                                                                                                                                                                  |
| `PERMISSION_SYNC_REPO_DRIVEN_ENABLED`          | `true`                 | <p>Enables/disables [repo-driven permission syncing](/docs/features/permission-syncing#how-it-works). Only applies when `PERMISSION_SYNC_ENABLED` is `true`.</p>                                                                                                                                                                                                         |
| `AUTH_EE_ALLOW_EMAIL_ACCOUNT_LINKING`          | `true`                 | <p>When enabled, different SSO accounts with the same email address will automatically be linked.</p>                                                                                                                                                                                                                                                                    |
| `DISABLE_API_KEY_CREATION_FOR_NON_OWNER_USERS` | `false`                | <p>When enabled, only organization owners can create API keys. Non-owner members will receive a `403` error if they attempt to create one.</p>                                                                                                                                                                                                                           |
| `DISABLE_API_KEY_USAGE_FOR_NON_OWNER_USERS`    | `false`                | <p>When enabled, only organization owners can create or use API keys. Non-owner members will receive a `403` error if they attempt to create or authenticate with an API key. If you only want to restrict creation (not usage), use `DISABLE_API_KEY_CREATION_FOR_NON_OWNER_USERS` instead.</p>                                                                         |

### Review Agent Environment Variables

| Variable                                   | Default  | Description                                                                                             |
| :----------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------ |
| `GITHUB_REVIEW_AGENT_APP_ID`               | `-`      | <p>The GitHub App ID used for review agent authentication.</p>                                          |
| `GITHUB_REVIEW_AGENT_APP_PRIVATE_KEY_PATH` | `-`      | <p>The container relative path to the private key file for the GitHub App used by the review agent.</p> |
| `GITHUB_REVIEW_AGENT_APP_WEBHOOK_SECRET`   | `-`      | <p>The webhook secret for the GitHub App used by the review agent.</p>                                  |
| `OPENAI_API_KEY`                           | `-`      | <p>The OpenAI API key used by the review agent.</p>                                                     |
| `REVIEW_AGENT_API_KEY`                     | `-`      | <p>The Sourcebot API key used by the review agent.</p>                                                  |
| `REVIEW_AGENT_AUTO_REVIEW_ENABLED`         | `false`  | <p>Enables/disables automatic code reviews by the review agent.</p>                                     |
| `REVIEW_AGENT_LOGGING_ENABLED`             | `true`   | <p>Enables/disables logging for the review agent. Logs are saved in `DATA_CACHE_DIR/review-agent`</p>   |
| `REVIEW_AGENT_REVIEW_COMMAND`              | `review` | <p>The command used to trigger a code review by the review agent.</p>                                   |

### Overriding environment variables from the config

You can override environment variables from the config file by using the `environmentOverrides` property. See [this doc](/docs/configuration/config-file#overriding-environment-variables-from-the-config) for more info.
