# Environment variables

> Reference of all environment variables that configure Stackable Cockpit, with their defaults, grouped by server, authentication, Trino and storage.

The Helm chart sets these variables from its values. Set them directly only when you run Cockpit without the chart. Cockpit does not start if a value is invalid, and the error names every invalid variable.

## Server

| Variable | Default | Description |
| --- | --- | --- |
| `NODE_ENV` | `production` | Set in the image. Other values switch to development defaults, such as no database TLS and `trace` logging. |
| `PORT` | `3000` | HTTP port Cockpit listens on. |
| `ORIGIN` |     | The URL users open in the browser. Requests from other origins are rejected. |
| `PROTOCOL_HEADER`, `HOST_HEADER` |     | Forwarded headers trusted behind a reverse proxy, for example `x-forwarded-proto` and `x-forwarded-host`. |
| `BODY_SIZE_LIMIT` | `5G` | Maximum request body size of all endpoints, and so the maximum upload file size in the storage browser. Requests other than uploads are limited to 6 MiB, or `PUBLIC_STACKABLE_COCKPIT_MAX_EDITABLE_FILE_SIZE` plus 1 MiB if that is larger. |
| `REQUEST_TIMEOUT` | `3600` | Time in seconds to receive a whole request, body included, and so the maximum duration of an upload in the storage browser. `0` disables it. |
| `LOG_LEVEL` | `info` | `trace`, `debug`, `info`, `warn` or `error`. |
| `LOG_PRETTY` | `false` in production, otherwise `true` | Human-readable instead of JSON logs on stdout. |
| `LOG_JSON_FILE` |     | Path of a file that also receives the JSON logs, for example for a log collector. |
| `STACKABLE_COCKPIT_TLS_CA_CERTS` |     | Comma-separated paths of PEM files with CA certificates. Trusted for all outgoing TLS connections, in addition to the CAs bundled with Node.js. |

## Database

| Variable | Default | Description |
| --- | --- | --- |
| `DATABASE_HOST` | `localhost` | PostgreSQL host. |
| `DATABASE_PORT` | `5432` | PostgreSQL port. |
| `DATABASE_NAME` | `cockpit` | Database name. |
| `DATABASE_USER` | `cockpit` | Database user. |
| `DATABASE_PASSWORD` |     | Database password. Required. |
| `DATABASE_TLS_MODE` | `verify-full` in production, otherwise `disable` | `verify-full`, `require` or `disable`. |

## Authentication

| Variable | Default | Description |
| --- | --- | --- |
| `STACKABLE_COCKPIT_BASE_URL` |     | The URL users open in the browser, used for the OIDC callback. |
| `STACKABLE_COCKPIT_SESSION_SECRET` |     | Secret that signs session cookies. |
| `STACKABLE_COCKPIT_OIDC_DISCOVERY_URL` |     | The `.well-known/openid-configuration` URL of the OIDC provider. Set this, the client ID and the client secret, or none of them. Without them, login is disabled; with only some, Cockpit does not start. |
| `STACKABLE_COCKPIT_OIDC_CLIENT_ID` |     | OIDC client ID. |
| `STACKABLE_COCKPIT_OIDC_CLIENT_SECRET` |     | OIDC client secret. |
| `STACKABLE_COCKPIT_OIDC_EXTRA_SCOPES` |     | Scopes requested in addition to `openid`, `profile` and `email`, separated by commas or spaces. |

## Trino

| Variable | Default | Description |
| --- | --- | --- |
| `STACKABLE_COCKPIT_TRINO_URL` |     | Trino coordinator URL for all users. Without it, users enter a connection in the UI. |
| `STACKABLE_COCKPIT_TRINO_PUBLIC_URL` | `STACKABLE_COCKPIT_TRINO_URL` | URL for links to the Trino web UI. |
| `STACKABLE_COCKPIT_TRINO_AUTH_TYPE` | `none` | `none` or `basic`. With `basic` and `STACKABLE_COCKPIT_TRINO_URL`, the username and password are required. |
| `STACKABLE_COCKPIT_TRINO_AUTH_USERNAME` |     | User for basic authentication. |
| `STACKABLE_COCKPIT_TRINO_AUTH_PASSWORD` |     | Password for basic authentication. |
| `STACKABLE_COCKPIT_TRINO_TLS_INSECURE` | `false` | Skip TLS certificate verification for `STACKABLE_COCKPIT_TRINO_URL`. Requires `STACKABLE_COCKPIT_TRINO_URL`. |
| `STACKABLE_COCKPIT_TRINO_USER_CONNECTION_TLS_ALLOW_INSECURE` | `false` | Let users skip TLS certificate verification for the connection they enter in the UI. Requires `STACKABLE_COCKPIT_TRINO_URL` to be unset. |
| `STACKABLE_COCKPIT_TRINO_USER_IMPERSONATION` | `true` | Send queries as the logged-in user. |
| `STACKABLE_COCKPIT_TRINO_USER_CLAIM` | `preferred_username` | OIDC claim used as the Trino user. |
| `STACKABLE_COCKPIT_COMPLETION_ENABLED` | `true` | SQL code completion. |
| `STACKABLE_COCKPIT_QUERY_TTL` | `1800` | Seconds that finished queries of an unused editor tab are kept. |

## Storage

| Variable | Default | Description |
| --- | --- | --- |
| `STACKABLE_COCKPIT_STORAGE_BROWSER_ENABLED` | `false` | Enables the storage module. |
| `STORAGE_ENCRYPTION_KEY` |     | 64-character hex key that encrypts stored S3 credentials. Required when the storage module is enabled. |
| `PUBLIC_STACKABLE_COCKPIT_STORAGE_TRANSFER_ENABLED` | `false` | Cut, copy, paste, rename and drag-and-drop move. |
| `PUBLIC_STACKABLE_COCKPIT_PAGE_SIZES` | `25,50,100` | Page sizes of paginated lists. |
| `PUBLIC_STACKABLE_COCKPIT_DEFAULT_PAGE_SIZE` | Smallest page size | Default page size. Must be one of the page sizes. |
| `PUBLIC_STACKABLE_COCKPIT_MAX_RECENT_FILES` | `15` | Recently visited locations kept in the browser. |
| `PUBLIC_STACKABLE_COCKPIT_UPLOAD_CONCURRENCY` | `3` | Parallel requests during uploads. |
| `PUBLIC_STACKABLE_COCKPIT_MAX_EDITABLE_FILE_SIZE` | `5242880` | Largest file in bytes that can be edited. Requests other than uploads may be this size plus 1 MiB (at least 6 MiB). |
| `STACKABLE_COCKPIT_TEXT_PREVIEW_BYTES` | `262144` | Bytes fetched for text, TSV and JSON previews. |
| `STACKABLE_COCKPIT_IMAGE_PREVIEW_BYTES` | `5242880` | Bytes fetched for image previews. |
| `STACKABLE_COCKPIT_PDF_PREVIEW_BYTES` | `26214400` | Bytes fetched for PDF previews. |
| `STACKABLE_COCKPIT_FILE_PREVIEW_ROWS` | `250` | Rows in tabular previews. |
| `STACKABLE_COCKPIT_FILE_PREVIEW_COLUMNS` | `50` | Columns in tabular previews. |
| `STACKABLE_COCKPIT_PARQUET_PREVIEW_DISALLOWED_COMPRESSION_TYPES` | `gzip-no_offset` | Parquet codecs that are not previewed. The suffix `-no_offset` blocks only files without an offset index. |
| `STACKABLE_COCKPIT_ARCHIVE_PREVIEW_MAX_MB` | `100` | Largest archive in MB that is previewed. |
| `STACKABLE_COCKPIT_ARCHIVE_CACHE_MAX_MB` | `512` | Size in MB of the archive cache in `/tmp`. At least twice the archive preview limit. |
| `STACKABLE_COCKPIT_STORAGE_TRANSFER_CONCURRENCY` | `8` | Objects copied in parallel within one copy, move or rename. |
| `STACKABLE_COCKPIT_DOWNLOAD_HISTORY_RETENTION_DAYS` | `30` | Days the download history is kept, from 1 to 3650. |

## Bookmarks

| Variable | Default | Description |
| --- | --- | --- |
| `STACKABLE_COCKPIT_GLOBAL_BOOKMARKS` |     | JSON array of bookmarks shown to every user, see [Global bookmarks](https://docs.stackable.tech/home/stable/cockpit/modules/bookmarks/index.md). Example: `[{"productId":"superset","name":"Dashboards","url":"https://superset.example.com"}]`. |
