# Configuration and environment variables

> Every Commentpin environment variable for self-hosting: app URL, database, sign-in, email, screenshot storage, scheduled jobs and integrations.

Source: https://commentpin.com/docs/configuration
Last updated: 2026-12-03

## Which environment variables does Commentpin use?

Commentpin reads its settings from environment variables, usually in a `.env` file. The full list with comments is in `.env.example` in the repository. With Docker Compose, the defaults work as they are.

## Core

| Variable             | What it does                                                                                          |
| -------------------- | ----------------------------------------------------------------------------------------------------- |
| `APP_URL`            | Public URL of the app, with no trailing slash. Used for sign-in links, emails and the widget snippet. |
| `DATABASE_URL`       | Postgres connection string. Docker Compose sets it.                                                   |
| `BETTER_AUTH_SECRET` | Signs sessions. At least 32 characters. Docker generates one if empty.                                |

## Sign-in

Magic links by email work out of the box. GitHub and Google buttons appear when both values are set:

- `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET` (callback `<APP_URL>/api/auth/callback/github`)
- `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET` (callback `<APP_URL>/api/auth/callback/google`)

## Email

| Variable                                                              | What it does                                       |
| --------------------------------------------------------------------- | -------------------------------------------------- |
| `EMAIL_FROM`                                                          | Sender name and address                            |
| `RESEND_API_KEY`                                                      | Use Resend. Takes priority over SMTP.              |
| `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASSWORD`, `SMTP_SECURE` | Any SMTP server. Docker Compose points at Mailpit. |

## Screenshot storage

| Variable                                                                                                   | What it does                                                                                                         |
| ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `STORAGE_DRIVER`                                                                                           | `auto` (default): S3 if the S3 values are set, otherwise local disk. Also `s3`, `local`, `none`.                     |
| `DATA_DIR`                                                                                                 | Local disk folder. Docker uses the `appdata` volume.                                                                 |
| `S3_ENDPOINT`, `S3_REGION`, `S3_BUCKET`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, `S3_FORCE_PATH_STYLE` | Any S3-compatible storage. The bucket needs a CORS rule allowing `PUT` with a `content-type` header from any origin. |

## Scheduled jobs

`CRON_SECRET` protects `/api/cron/*`. Docker generates it, and the `cron` service calls the jobs.

## Integrations

GitHub, Linear and webhook settings are in [integration setup](/docs/integrations). `ENCRYPTION_KEY` encrypts stored tokens. `WEBHOOKS_ALLOW_PRIVATE=true` lets webhooks reach private network addresses.

## Single sign-on

`SSO_IDP_ORIGINS` adds identity provider addresses for [single sign-on](/docs/single-sign-on), comma-separated, such as `https://sso.example.com,https://*.my-idp.com`. Okta, Microsoft Entra ID, Google, Auth0, OneLogin, JumpCloud and Ping are allowed without it.

See also [Docker](/docs/self-hosting/docker) and [running on a VPS](/docs/self-hosting/vps).
