---
title: Environment variables
description: "To see a complete list of environment variables for a specific data source, please check the relevant page on Connecting to Data Sources."
---

<Info>

To see a complete list of environment variables for a specific data source,
please check the relevant page on [Connecting to Data Sources][ref-config-db].

</Info>

## `CUBEJS_API_SECRET`

The secret key used to sign and verify JWTs. Generated on project scaffold with
`npx cubejs-cli create`.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string  | N/A                    | N/A                   |

See also the [`check_auth` configuration
option](/reference/configuration/config#check_auth).

## `CUBEJS_APP`

An application ID used to uniquely identify the Cube deployment. Can be
different for multitenant setups.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string  | `cubejs`               | `cubejs`              |

## `CUBEJS_AUTO_RUN_MODE`

The deployment-wide default for whether [Explore](/docs/explore-analyze/explore)
and [Workbooks](/docs/explore-analyze/workbooks/querying-data) tabs run their
query automatically as it's built, or wait for an explicit **Run query**. Set
via the **Auto-run** switch in [Model Configuration](/docs/data-modeling/configuration#auto-run).
A view's `meta.auto_run` setting and a user's per-tab toggle both take
precedence over this default. Only the literal string `false` turns it off —
any other value (including unset) is treated as on.

| Possible Values | Default in Development | Default in Production |
| ---------------- | ----------------------- | ----------------------- |
| `true`, `false`  | `true`                   | `true`                   |

## `CUBEJS_AWS_KEY`

The AWS Access Key ID to use for database connections.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid AWS Access Key ID | N/A                    | N/A                   |

## `CUBEJS_AWS_SECRET`

The AWS Secret Access Key to use for database connections.

| Possible Values               | Default in Development | Default in Production |
| ----------------------------- | ---------------------- | --------------------- |
| A valid AWS Secret Access Key | N/A                    | N/A                   |

## `CUBEJS_AWS_REGION`

The AWS region to use for database connections.

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| [A valid AWS region][aws-docs-regions] | N/A                    | N/A                   |

## `CUBEJS_AWS_S3_OUTPUT_LOCATION`

The S3 path to store [AWS Athena][aws-athena] query results made by Cube.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid S3 path | N/A                    | N/A                   |

## `CUBEJS_AWS_ATHENA_WORKGROUP`

The name of the [AWS Athena workgroup][aws-athena-workgroup] in which the query
is being started.

| Possible Values                                  | Default in Development | Default in Production |
| ------------------------------------------------ | ---------------------- | --------------------- |
| [A valid Athena Workgroup][aws-athena-workgroup] | N/A                    | N/A                   |

## `CUBEJS_AWS_ATHENA_CATALOG`

The name of the AWS Athena catalog to use for queries.

| Possible Values                                   | Default in Development | Default in Production |
| ------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Athena Catalog name][aws-athena-catalog] | N/A                    | N/A                   |

## `CUBEJS_AWS_ATHENA_ASSUME_ROLE_ARN`

The ARN of the IAM role to assume for Athena access.

| Possible Values      | Default in Development | Default in Production |
| -------------------- | ---------------------- | --------------------- |
| A valid IAM role ARN | N/A                    | N/A                   |

## `CUBEJS_AWS_ATHENA_ASSUME_ROLE_EXTERNAL_ID`

The external ID to use when assuming the IAM role, if required by the role's
trust policy.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A string        | N/A                    | N/A                   |

## `CUBEJS_DB_SCHEMA`

The name of the schema to use as `information_schema` filter. Reduces count of
tables loaded during data model generation.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid schema name | N/A                    | N/A                   |

## `CUBEJS_CACHE_AND_QUEUE_DRIVER`

The cache and queue driver to use for the Cube deployment.

| Possible Values       | Default in Development | Default in Production |
| --------------------- | ---------------------- | --------------------- |
| `cubestore`, `memory` | `memory`               | `cubestore`           |

It can be also set using the [`cache_and_queue_driver` configuration
option](/reference/configuration/config#cache_and_queue_driver).

## `CUBEJS_COMPILER_CACHE_SIZE`

The maximum number of compiled data models to keep in the in-memory compiler
cache. When the maximum is reached, the least recently used data models are
dropped from the cache. The optimum value depends on the deployed environment.

This variable sizes two separate caches: the data model compiler cache and the
[SQL API][ref-sql-api]'s own compiler cache. Setting it applies the same maximum
to both. When it is unset, each falls back to its own default, so the effective
default differs between them.

| Cache                     | Possible Values   | Default in Development | Default in Production |
| ------------------------- | ----------------- | ---------------------- | --------------------- |
| Data model compiler cache | A positive number | `250`                  | `250`                 |
| SQL API compiler cache    | A positive number | `100`                  | `100`                 |

<Note>
Neither cache can be disabled, so `0` is rejected rather than accepted and
ignored. The same applies to the configuration option.
</Note>

The data model compiler cache can be also sized using the [`compiler_cache_size`
configuration option](/reference/configuration/config#compiler_cache_size),
which takes precedence over this environment variable. The SQL API compiler
cache reads this environment variable only, so the configuration option does not
affect it.

## `CUBEJS_CONCURRENCY`

The number of concurrent connections each query queue has to the database.

| Possible Values | Default in Development                      | Default in Production                       |
| --------------- | ------------------------------------------- | ------------------------------------------- |
| A valid number  | [See database-specific page][ref-config-db] | [See database-specific page][ref-config-db] |

It can be also set as `concurrency` in the [`orchestrator_options` configuration
option](/reference/configuration/config#orchestrator_options).

If you'd like to adjust the concurrency for the refresh worker, use
[`CUBEJS_REFRESH_WORKER_CONCURRENCY`](/reference/configuration/environment-variables#cubejs_refresh_worker_concurrency).

## `CUBEJS_REFRESH_WORKER_CONCURRENCY`

The number of pre-aggregation queries the refresh worker executes concurrently
against the source database.

| Possible Values | Default in Development       | Default in Production        |
| --------------- | ---------------------------- | ---------------------------- |
| A valid number  | Same as [`CUBEJS_CONCURRENCY`](/reference/configuration/environment-variables#cubejs_concurrency) | Same as [`CUBEJS_CONCURRENCY`](/reference/configuration/environment-variables#cubejs_concurrency) |

## `CUBEJS_SCHEDULED_REFRESH_QUERIES_PER_APP_ID`

How many pre-aggregations the refresh worker will build in parallel for each
application id as determined by the [`context_to_app_id`][ref-context-to-app-id]
configuration option.

Note that this parameter doesn't override the overall refresh worker concurrency,
configured via the [`CUBEJS_REFRESH_WORKER_CONCURRENCY`](/reference/configuration/environment-variables#cubejs_refresh_worker_concurrency) environment variable, and
it should be adjusted accordingly.

| Possible Values                      | Default in Development | Default in Production |
| ------------------------------------ | ---------------------- | --------------------- |
| A valid number of concurrent queries | 10                     | 10                    |

## `CUBEJS_CUBESTORE_HOST`

The hostname of the Cube Store deployment

| Possible Values  | Default in Development | Default in Production |
| ---------------- | ---------------------- | --------------------- |
| A valid hostname | `localhost`            | N/A                   |

## `CUBEJS_CUBESTORE_PORT`

The port of the Cube Store deployment.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | `3030`                 | `3030`                |

## `CUBEJS_CUBESTORE_MAX_MESSAGE_SIZE`

The maximum size of a single message Cube will send to or accept from Cube
Store. A result above this size is reported as `Cube Store response size
exceeds the maximum message size`; see
[message size limits](/docs/pre-aggregations/cube-store-architecture#message-size-limits).
This is Cube's own limit and is independent of
[`CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE`](#cubestore_transport_max_message_size),
which Cube Store applies to what it receives.

| Possible Values      | Default in Development | Default in Production |
| -------------------- | ---------------------- | --------------------- |
| A size in bytes      | `104857600` (100 MB)   | `104857600` (100 MB)  |

## `CUBEJS_QUEUE_FAST_TRACK`

<Warning>

The fast-track path is experimental and off by default. Its behavior may still change,
and we don't recommend enabling it in production yet.

</Warning>

Enables the preview fast-track path for Cube Store query queues. When enabled,
Cube can atomically enqueue and retrieve a query when queue concurrency is
available, reducing queue coordination round trips. This requires Cube and Cube Store
1.7.26 or newer; against an older version Cube keeps using the regular path.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_DATASOURCES`

A comma-separated list of data source names. Data sources defined here can be
used to [decorate `CUBEJS_DB_*`][ref-config-multiple-ds-decorating-env]
environment variables.

| Possible Values                   | Default in Development | Default in Production |
| --------------------------------- | ---------------------- | --------------------- |
| A comma-separated list of strings | N/A                    | N/A                   |

```dotenv
CUBEJS_DATASOURCES=default,datasource1
```

<Info>

In Cube Cloud, this variable is **auto-maintained** when sources are managed
from [**Settings → Data Sources**][ref-config-multiple-ds-cloud]. The page
writes, updates, and removes it as you add or delete named sources — you
only need to hand-edit it when configuring Cube Core or when overriding
the UI from
[**Settings → Environment Variables**](/admin#environment-variables).

</Info>

## `CUBEJS_DB_BQ_CREDENTIALS`

A Base64 encoded JSON key file for connecting to Google BigQuery.

| Possible Values                                                  | Default in Development | Default in Production |
| ---------------------------------------------------------------- | ---------------------- | --------------------- |
| A valid Google BigQuery JSON key file encoded as a Base64 string | N/A                    | N/A                   |

## `CUBEJS_DB_BQ_KEY_FILE`

The path to a JSON key file for connecting to Google BigQuery.

| Possible Values                       | Default in Development | Default in Production |
| ------------------------------------- | ---------------------- | --------------------- |
| A valid Google BigQuery JSON key file | N/A                    | N/A                   |

## `CUBEJS_DB_BQ_LOCATION`

The Google BigQuery dataset location to connect to. Required if used with
pre-aggregations outside of US. If not set then BQ driver will fail with
`Dataset was not found in location US` error.

| Possible Values                                                         | Default in Development | Default in Production |
| ----------------------------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Google BigQuery regional location][bq-docs-regional-locations] | N/A                    | N/A                   |

## `CUBEJS_DB_BQ_PROJECT_ID`

The Google BigQuery project ID to connect to.

| Possible Values                    | Default in Development | Default in Production |
| ---------------------------------- | ---------------------- | --------------------- |
| A valid Google BigQuery Project ID | N/A                    | N/A                   |

## `CUBEJS_DB_CLICKHOUSE_READONLY`

Whether the ClickHouse user has read-only access or not.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | N/A                    | N/A                   |

## `CUBEJS_DB_CLICKHOUSE_COMPRESSION`

Whether the ClickHouse client has compression enabled or not.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_DB_DATABRICKS_ACCEPT_POLICY`

To accept the license terms for the Databricks JDBC driver, this must be set to
`true`.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | N/A                    | N/A                   |

## `CUBEJS_DB_DATABRICKS_CATALOG`

The name of the [Databricks catalog][databricks-catalog] to connect to.

| Possible Values                 | Default in Development | Default in Production |
| ------------------------------- | ---------------------- | --------------------- |
| A valid Databricks catalog name | N/A                    | N/A                   |

[databricks-catalog]: https://docs.databricks.com/en/data-governance/unity-catalog/create-catalogs.html

## `CUBEJS_DB_DATABRICKS_OAUTH_CLIENT_ID`

The OAuth client ID for [service principal][ref-databricks-m2m-oauth] authentication in Databricks.

| Possible Values        | Default in Development | Default in Production |
| ---------------------- | ---------------------- | --------------------- |
| A valid client ID      | N/A                    | N/A                   |

## `CUBEJS_DB_DATABRICKS_OAUTH_CLIENT_SECRET`

The OAuth client secret for [service principal][ref-databricks-m2m-oauth] authentication in Databricks.

| Possible Values        | Default in Development | Default in Production |
| ---------------------- | ---------------------- | --------------------- |
| A valid client secret  | N/A                    | N/A                   |

## `CUBEJS_DB_DATABRICKS_TOKEN`

The [personal access token][databricks-docs-pat] used to authenticate the
Databricks connection.

| Possible Values                 | Default in Development | Default in Production |
| ------------------------------- | ---------------------- | --------------------- |
| A valid Databricks access token | N/A                    | N/A                   |

## `CUBEJS_DB_DATABRICKS_URL`

The URL for a JDBC connection.

| Possible Values  | Default in Development | Default in Production |
| ---------------- | ---------------------- | --------------------- |
| A valid JDBC URL | N/A                    | N/A                   |

## `CUBEJS_DB_DOMAIN`

A domain name within an MS SQL database to connect to.

| Possible Values                              | Default in Development | Default in Production |
| -------------------------------------------- | ---------------------- | --------------------- |
| A valid domain name within a MS SQL database | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_MEMORY_LIMIT`

The [maximum memory limit][duckdb-docs-config] for DuckDB. Equivalent to
`SET memory_limit=<MEMORY_LIMIT>`.

| Possible Values                  | Default in Development | Default in Production |
| -------------------------------- | ---------------------- | --------------------- |
| A valid MotherDuck service token | 75% of available RAM   | 75% of available RAM  |

[duckdb-docs-config]: https://duckdb.org/docs/sql/configuration.html

## `CUBEJS_DB_DUCKDB_SCHEMA`

The [default search schema][duckdb-docs-config] for DuckDB.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid schema name | `main`                 | `main`                |

## `CUBEJS_DB_DUCKDB_MOTHERDUCK_TOKEN`

The [service token][motherduck-docs-svc-token] to use for connections to
MotherDuck.

| Possible Values                  | Default in Development | Default in Production |
| -------------------------------- | ---------------------- | --------------------- |
| A valid MotherDuck service token | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_DATABASE_PATH`

The database filepath to use for connection to a local database.

| Possible Values                   | Default in Development | Default in Production |
| --------------------------------- | ---------------------- | --------------------- |
| A valid duckdb database file path | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_S3_ACCESS_KEY_ID`

The AWS Access Key ID to use for S3 connections.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid AWS Access Key ID | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_S3_SECRET_ACCESS_KEY`

The AWS Secret Access Key to use for S3 connections.

| Possible Values               | Default in Development | Default in Production |
| ----------------------------- | ---------------------- | --------------------- |
| A valid AWS Secret Access Key | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_S3_ENDPOINT`

The AWS endpoint to use for S3 connections.

| Possible Values                                   | Default in Development | Default in Production |
| ------------------------------------------------- | ---------------------- | --------------------- |
| [A valid AWS S3 endpoint][aws-docs-vpc-endpoints] | N/A                    | N/A                   |

[aws-docs-vpc-endpoints]:
  https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html

## `CUBEJS_DB_DUCKDB_S3_REGION`

The AWS region to use for S3 connections.

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| [A valid AWS region][aws-docs-regions] | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_S3_USE_SSL`

Use SSL when connecting to S3.

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| True or false                          | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_S3_URL_STYLE`

The URL style to be used by S3.

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| [vhost/path]                           | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_S3_SESSION_TOKEN`

The S3 session token.

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| A valid S3 session token               | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_EXTENSIONS`

A comma-separated list of DuckDB extensions	to install and load.

| Possible Values                             | Default in Development | Default in Production |
| ------------------------------------------- | ---------------------- | --------------------- |
| A comma-separated list of DuckDB extensions | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_COMMUNITY_EXTENSIONS`

A comma-separated list of DuckDB community extensions	to install and load.

| Possible Values                                       | Default in Development | Default in Production |
| ----------------------------------------------------- | ---------------------- | --------------------- |
| A comma-separated list of DuckDB community extensions | N/A                    | N/A                   |

## `CUBEJS_DB_DUCKDB_S3_USE_CREDENTIAL_CHAIN`

A flag to use credentials chain for secrets for S3 connections.

| Possible Values                                       | Default in Development | Default in Production |
| ----------------------------------------------------- | ---------------------- | --------------------- |
| `true`, `false`                                       | `false`                | `false`               |

## `CUBEJS_DB_EXPORT_BUCKET`

The name of a bucket in cloud storage to store the database export snapshots.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values                                | Default in Development | Default in Production |
| ---------------------------------------------- | ---------------------- | --------------------- |
| A valid bucket in the configured cloud storage | N/A                    | N/A                   |

```dotenv
CUBEJS_DB_EXPORT_BUCKET=exports-20210505

# Decorated with a data source named `datasource1`
CUBEJS_DS_DATASOURCE1_DB_EXPORT_BUCKET=exports-20210505
```

## `CUBEJS_DB_EXPORT_BUCKET_TYPE`

The cloud provider where the bucket is hosted.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `gcp`, `s3`     | N/A                    | N/A                   |

```dotenv
CUBEJS_DB_EXPORT_BUCKET_TYPE=gcp

# Decorated with a data source named `datasource1`
CUBEJS_DS_DATASOURCE1_DB_EXPORT_BUCKET_TYPE=gcp
```

## `CUBEJS_DB_EXPORT_BUCKET_AWS_KEY`

The AWS Access Key ID to use for the export bucket.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid AWS Access Key ID | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_AWS_SECRET`

The AWS Secret Access Key to use for the export bucket.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values               | Default in Development | Default in Production |
| ----------------------------- | ---------------------- | --------------------- |
| A valid AWS Secret Access Key | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_AWS_REGION`

The AWS region of the export bucket.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| [A valid AWS region][aws-docs-regions] | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_AZURE_KEY`

The Azure Access Key to use for the export bucket.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values          | Default in Development | Default in Production |
| ------------------------ | ---------------------- | --------------------- |
| A valid Azure Access Key | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_AZURE_TENANT_ID`

The Azure tenant ID to use for the export bucket.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values         | Default in Development | Default in Production |
| ----------------------- | ---------------------- | --------------------- |
| A valid Azure Tenant ID | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_AZURE_CLIENT_ID`

The Azure client ID to use for the export bucket.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values         | Default in Development | Default in Production |
| ----------------------- | ---------------------- | --------------------- |
| A valid Azure Client ID | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_AZURE_CLIENT_SECRET`

The Azure client secret to use for the export bucket.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values             | Default in Development | Default in Production |
| --------------------------- | ---------------------- | --------------------- |
| A valid Azure Client Secret | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_MOUNT_DIR`

The mount path to use for a [Databricks DBFS mount][databricks-docs-dbfs].

| Possible Values    | Default in Development | Default in Production |
| ------------------ | ---------------------- | --------------------- |
| A valid mount path | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_BUCKET_REDSHIFT_ARN`

An ARN of an AWS IAM role with permission to write to the configured bucket (see
[`CUBEJS_DB_EXPORT_BUCKET`](/reference/configuration/environment-variables#cubejs_db_export_bucket)).

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values                                                            | Default in Development | Default in Production |
| -------------------------------------------------------------------------- | ---------------------- | --------------------- |
| A valid ARN to an IAM Role associated with the target Redshift data source | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_GCS_CREDENTIALS`

A Base64 encoded JSON key file for connecting to Google Cloud.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values                                               | Default in Development | Default in Production |
| ------------------------------------------------------------- | ---------------------- | --------------------- |
| A valid Google Cloud JSON key file encoded as a Base64 string | N/A                    | N/A                   |

## `CUBEJS_DB_EXPORT_INTEGRATION`

The name of the integration used in the database. Only required when using
Snowflake and Google Cloud Storage.

<Info>

When using multiple data sources, this environment variable can be [decorated
with a data source][ref-config-multiple-ds-decorating-env].

</Info>

| Possible Values                                                  | Default in Development | Default in Production |
| ---------------------------------------------------------------- | ---------------------- | --------------------- |
| A valid string matching the name of the integration in Snowflake | N/A                    | N/A                   |

## `CUBEJS_DB_HOST`

The host URL for a database.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid database host URL | N/A                    | N/A                   |

## `CUBEJS_DB_SOCKET_PATH`

The path to a Unix socket that is used to connect to a data source, e.g.,
[MySQL](/admin/connect-to-data/data-sources/mysql#connecting-via-a-unix-socket).

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid path to a socket  | N/A                    | N/A                   |

## `CUBEJS_DB_MAX_POOL`

The maximum number of concurrent database connections to pool.

| Possible Values | Default in Development                      | Default in Production                       |
| --------------- | ------------------------------------------- | ------------------------------------------- |
| A valid number  | [See database-specific page][ref-config-db] | [See database-specific page][ref-config-db] |

## `CUBEJS_DB_NAME`

The name of the database to connect to.

| Possible Values       | Default in Development | Default in Production |
| --------------------- | ---------------------- | --------------------- |
| A valid database name | N/A                    | N/A                   |

## `CUBEJS_DB_PASS`

The password used to connect to the database.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid database password | N/A                    | N/A                   |

## `CUBEJS_DB_PORT`

The port for the database connection.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | N/A                    | N/A                   |

## `CUBEJS_DB_PRECISE_DECIMAL_IN_CUBESTORE`

If `true`, decimal columns maintain their precision and scale specifications (e.g.,
`decimal(10, 2)`) rather than being converted to a generic decimal type when data is
exported from a data source to Cube Store.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_DB_PRESTO_CATALOG`

The catalog within Presto/Trino to connect to.

| Possible Values                                     | Default in Development | Default in Production |
| --------------------------------------------------- | ---------------------- | --------------------- |
| A valid catalog name within a Presto/Trino database | N/A                    | N/A                   |

## `CUBEJS_DB_PRESTO_AUTH_TOKEN`

The authentication token to use when connecting to Presto/Trino. It will be sent in the `Authorization` header.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid authentication token | N/A | N/A |

## `CUBEJS_DB_QUERY_TIMEOUT`

The timeout value for any queries made to the database by Cube.

| Possible Values                          | Default in Development | Default in Production |
| ---------------------------------------- | ---------------------- | --------------------- |
| A number in seconds or a duration string | `10m`                  | `10m`                 |

<Info>

There's a hard limit of 20 minutes for queries that ingest data into Cube Store
when pre-aggregations are built. If you bump into this limit, consider using
an export bucket and splitting pre-aggregations into partitions.

</Info>

## `CUBEJS_DB_FETCH_COLUMNS_BY_ORDINAL_POSITION`

Force fetching of columns by ordinal positions. Certain data-providers (e.g., Redshift) do not guarantee columns in the
same order on each request (e.g., `SELECT * FROM foo`). This flag ensures that columns will be fetched in proper order
for pre-aggregation generation.

| Possible Values                                    | Default in Development | Default in Production |
| -------------------------------------------------- | ---------------------- | --------------------- |
| Whether to force fetch columns in ordinal position | `true`                 | `true`               |

## `CUBEJS_DB_HIVE_TYPE`

The type of Hive server to connect to.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `HIVE`, `CDH`   | `HIVE`                 | `HIVE`                |

## `CUBEJS_DB_HIVE_VER`

The version of the Hive server to connect to.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid Hive version | `2.1.1`               | `2.1.1`               |

## `CUBEJS_DB_HIVE_THRIFT_VER`

The version of the Thrift protocol used to connect to Hive.

| Possible Values       | Default in Development | Default in Production |
| --------------------- | ---------------------- | --------------------- |
| A valid Thrift version | `0.9.3`               | `0.9.3`               |

## `CUBEJS_DB_HIVE_CDH_VER`

The Cloudera Distribution Hadoop (CDH) version, used when `CUBEJS_DB_HIVE_TYPE`
is set to `CDH`.

| Possible Values    | Default in Development | Default in Production |
| ------------------ | ---------------------- | --------------------- |
| A valid CDH version | N/A                   | N/A                   |

## `CUBEJS_DB_KAFKA_HOST`

Kafka broker host(s) for [Kafka streams mode](/admin/connect-to-data/data-sources/ksqldb#kafka-streams-mode).
Multiple brokers can be comma-separated.

| Possible Values          | Default in Development | Default in Production |
| ------------------------ | ---------------------- | --------------------- |
| A valid Kafka broker URL | N/A                    | N/A                   |

## `CUBEJS_DB_KAFKA_USER`

Username for Kafka broker authentication (SASL PLAIN).

| Possible Values        | Default in Development | Default in Production |
| ---------------------- | ---------------------- | --------------------- |
| A valid Kafka username | N/A                    | N/A                   |

## `CUBEJS_DB_KAFKA_PASS`

Password for Kafka broker authentication (SASL PLAIN).

| Possible Values        | Default in Development | Default in Production |
| ---------------------- | ---------------------- | --------------------- |
| A valid Kafka password | N/A                    | N/A                   |

## `CUBEJS_DB_KAFKA_USE_SSL`

If `true`, enables SASL_SSL for the Kafka connection.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_DB_MATERIALIZE_CLUSTER`

The cluster name to use when connecting to [Materialize](/admin/connect-to-data/data-sources/materialize).

| Possible Values                                           | Default in Development | Default in Production |
| --------------------------------------------------------- | ---------------------- | --------------------- |
| A valid Materialize cluster name                          | N/A                    | N/A                   |

## `CUBEJS_DB_MYSQL_USE_NAMED_TIMEZONES`

This flag controls how time zones conversion is done in the generated SQL for MySQL:
- If it is set to `true`, time zone names are used. In this case, your MySQL server needs
to be [configured][mysql-server-tz-support] properly.
- If it is set to `false`, numeric offsets are used instead.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_DB_MSSQL_USE_NAMED_TIMEZONES`

This flag controls how time zone conversion is done in the generated SQL for Microsoft
SQL Server:
- If it is set to `true`, time zone names are used, with DST-aware conversion via
`AT TIME ZONE`.
- If it is set to `false`, numeric offsets are used instead.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_DB_REDSHIFT_CLUSTER_IDENTIFIER`

The Redshift cluster identifier. Required for IAM authentication.

| Possible Values            | Default in Development | Default in Production |
| -------------------------- | ---------------------- | --------------------- |
| A valid cluster identifier | N/A                    | N/A                   |

## `CUBEJS_DB_REDSHIFT_AWS_REGION`

The AWS region of the Redshift cluster. Required for IAM authentication.

| Possible Values    | Default in Development | Default in Production |
| ------------------ | ---------------------- | --------------------- |
| A valid AWS region | N/A                    | N/A                   |

## `CUBEJS_DB_REDSHIFT_ASSUME_ROLE_ARN`

The ARN of the IAM role to assume for cross-account access.

| Possible Values      | Default in Development | Default in Production |
| -------------------- | ---------------------- | --------------------- |
| A valid IAM role ARN | N/A                    | N/A                   |

## `CUBEJS_DB_REDSHIFT_ASSUME_ROLE_EXTERNAL_ID`

The external ID for the assumed role's trust policy.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A string        | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_ACCOUNT`

The Snowflake account identifier to use when connecting to the database.

| Possible Values                                           | Default in Development | Default in Production |
| --------------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Snowflake account ID][snowflake-docs-account-id] | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_AUTHENTICATOR`

The type of authenticator to use with Snowflake. Use `SNOWFLAKE` with
username/password, or `SNOWFLAKE_JWT` with key pairs.

| Possible Values              | Default in Development | Default in Production |
| ---------------------------- | ---------------------- | --------------------- |
| `SNOWFLAKE`, `SNOWFLAKE_JWT` | `SNOWFLAKE`            | `SNOWFLAKE`           |

## `CUBEJS_DB_SNOWFLAKE_OAUTH_TOKEN`

The OAuth token to use with Snowflake.

| Possible Values                | Default in Development | Default in Production |
| ------------------------------ | ---------------------- | --------------------- |
| A valid OAuth token            | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_OAUTH_TOKEN_PATH`

The path to the file containing the OAuth token for Snowflake.

| Possible Values                | Default in Development | Default in Production |
| ------------------------------ | ---------------------- | --------------------- |
| A valid OAuth token            | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_CLIENT_SESSION_KEEP_ALIVE`

If `true`, [keep the Snowflake connection alive
indefinitely][snowflake-docs-connection-options].

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

## `CUBEJS_DB_SNOWFLAKE_PRIVATE_KEY`

The content of the private RSA key (encrypted or not).

| Possible Values                | Default in Development | Default in Production |
| ------------------------------ | ---------------------- | --------------------- |
| Content of the private RSA key | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_PRIVATE_KEY_PASS`

The password for the private RSA key. Only required for encrypted keys.

| Possible Values                                    | Default in Development | Default in Production |
| -------------------------------------------------- | ---------------------- | --------------------- |
| A valid password for the encrypted private RSA key | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_PRIVATE_KEY_PATH`

The path to the private RSA key folder.

| Possible Values                     | Default in Development | Default in Production |
| ----------------------------------- | ---------------------- | --------------------- |
| A valid path to the private RSA key | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_REGION`

The Snowflake region to use when connecting to the database.

| Possible Values                                    | Default in Development | Default in Production |
| -------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Snowflake region][snowflake-docs-regions] | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_ROLE`

The Snowflake role to use when connecting to the database.

| Possible Values                                               | Default in Development | Default in Production |
| ------------------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Snowflake role][snowflake-docs-roles] in the account | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_WAREHOUSE`

The Snowflake warehouse to use when connecting to the database.

| Possible Values                                                        | Default in Development | Default in Production |
| ---------------------------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Snowflake warehouse][snowflake-docs-warehouse] in the account | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_HOST`

Host address to which the driver should connect.

| Possible Values  | Default in Development | Default in Production |
| ---------------- | ---------------------- | --------------------- |
| A valid hostname | N/A                    | N/A                   |

## `CUBEJS_DB_SNOWFLAKE_QUOTED_IDENTIFIERS_IGNORE_CASE`

Whether or not [quoted identifiers should be case insensitive](https://docs.snowflake.com/en/sql-reference/identifiers-syntax#double-quoted-identifiers).

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_DB_PINOT_NULL_HANDLING`

The Startree/Pinot null value support. If `true`, enables null handling.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` |	`false`                | `false`               |

## `CUBEJS_DB_PINOT_AUTH_TOKEN`

The authentication token for StarTree to be passed as HTTP headers.

| Possible Values                     | Default in Development | Default in Production |
| ----------------------------------- | ---------------------- | --------------------- |
| A valid string containing the token |	N/A                    | N/A                   |

## `CUBEJS_DB_SSL`

If `true`, enables SSL encryption for database connections from Cube.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | N/A                    | N/A                   |

## `CUBEJS_DB_SSL_CA`

The contents of a CA bundle in PEM format, or a path to one. For more
information, check the `options.ca` property for TLS Secure Contexts [in the
Node.js documentation][nodejs-docs-tls-options].

| Possible Values                    | Default in Development | Default in Production |
| ---------------------------------- | ---------------------- | --------------------- |
| A valid CA bundle or a path to one | N/A                    | N/A                   |

## `CUBEJS_DB_SSL_CERT`

The contents of an SSL certificate in PEM format, or a path to one. For more
information, check the `options.cert` property for TLS Secure Contexts [in the
Node.js documentation][nodejs-docs-tls-options].

| Possible Values                          | Default in Development | Default in Production |
| ---------------------------------------- | ---------------------- | --------------------- |
| A valid SSL certificate or a path to one | N/A                    | N/A                   |

## `CUBEJS_DB_SSL_KEY`

The contents of a private key in PEM format, or a path to one. For more
information, check the `options.key` property for TLS Secure Contexts [in the
Node.js documentation][nodejs-docs-tls-options].

| Possible Values                          | Default in Development | Default in Production |
| ---------------------------------------- | ---------------------- | --------------------- |
| A valid SSL private key or a path to one | N/A                    | N/A                   |

## `CUBEJS_DB_SSL_SERVERNAME`

The server name to use for SNI (Server Name Indication) when establishing the
TLS connection. For more information, check the `options.servername` property
for TLS Secure Contexts [in the Node.js documentation][nodejs-docs-tls-options].

| Possible Values   | Default in Development | Default in Production |
| ----------------- | ---------------------- | --------------------- |
| A valid host name | N/A                    | N/A                   |

## `CUBEJS_DB_TYPE`

A database from the list of [supported databases][ref-config-db].

| Possible Values                                       | Default in Development | Default in Production |
| ----------------------------------------------------- | ---------------------- | --------------------- |
| [Any valid database supported by Cube][ref-config-db] | N/A                    | N/A                   |

## `CUBEJS_DB_URL`

The URL for a database.

| Possible Values      | Default in Development | Default in Production |
| -------------------- | ---------------------- | --------------------- |
| A valid database URL | N/A                    | N/A                   |

## `CUBEJS_DB_USER`

The username used to connect to the database.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid database username | N/A                    | N/A                   |

## `CUBEJS_DB_QUERY_DEFAULT_LIMIT`

The default [row limit][ref-row-limit] in the result set if it's not explicitly
specified in an API query.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A positive integer number | `10000`                | `10000`               |

## `CUBEJS_DB_QUERY_LIMIT`

The maximum [row limit][ref-row-limit] in the result set. An explicit limit in a
query cannot exceed this value, except for [SQL API][ref-sql-api] queries when
[streaming mode][ref-sql-api-streaming] is enabled. SQL API queries that are not
streamed can be capped separately, at a lower value, with
[`CUBESQL_NON_STREAMING_QUERY_MAX_ROW_LIMIT`](#cubesql_non_streaming_query_max_row_limit).

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A positive integer number | `50000`                | `50000`               |

<Warning>

Increasing the maximum row limit may cause out-of-memory (OOM) crashes and make
Cube susceptible to denial-of-service (DoS) attacks if it's exposed to
untrusted environments.

</Warning>

## `CUBEJS_DEFAULT_TIMEZONE`

The default [time zone][ref-time-zone] for queries.

| Possible Values        | Default in Development | Default in Production |
| ---------------------- | ---------------------- | --------------------- |
| A valid time zone name | `UTC`                  | `UTC`                 |

You can set the time zone name in the [TZ Database Name][link-tzdb] format, e.g.,
`America/Los_Angeles`.

<Warning>

An invalid value fails at server startup. Only TZ Database names are accepted — fixed
UTC offsets such as `+05:00` are rejected.

</Warning>

This is the fallback. When [user time zones](/admin/time-zones) are enabled for the
account, a resolved account, personal, dashboard, or embed zone is sent with the query and
takes precedence over this value.

## `CUBEJS_DEFAULT_API_SCOPES`

[API scopes][ref-rest-scopes] used to allow or disallow access to REST (JSON) API
endpoints.

| Possible Values                                                                | Default in Development | Default in Production |
| ------------------------------------------------------------------------------ | ---------------------- | --------------------- |
| A comma-delimited string with any combination of [API scopes][ref-rest-scopes] | `meta,data,graphql,sql`| `meta,data,graphql,sql`|

See also the [`context_to_api_scopes` configuration
option](/reference/configuration/config#context_to_api_scopes).

## `CUBEJS_DEV_MODE`

If `true`, enables [development mode](/docs/data-modeling/dev-mode).

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `false`               |

## `CUBEJS_DROP_PRE_AGG_WITHOUT_TOUCH`

If `true`, it enables dropping pre-aggregations that Refresh Worker doesn't
touch within [`CUBEJS_TOUCH_PRE_AGG_TIMEOUT`](/reference/configuration/environment-variables#cubejs_touch_pre_agg_timeout).
Pre-aggregations are touched whenever they are rebuilt or a Refresh Worker
checks its freshness. The first drop will be initiated when the Refresh Worker
is able to check freshness for every `scheduledRefresh: true` pre-aggregation.
If you have multiple Refresh Workers with different data model versions sharing
the same Cube Store cluster, then touches from both refresh workers are
respected.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

## `CUBEJS_FIREBOLT_ACCOUNT`

The [Firebolt account name][firebolt-docs-account-name].

| Possible Values                                             | Default in Development | Default in Production |
| ----------------------------------------------------------- | ---------------------- | --------------------- |
| A valid [Firebolt account name][firebolt-docs-account-name] | N/A                    | N/A                   |

## `CUBEJS_FIREBOLT_API_ENDPOINT`

The Firebolt API endpoint. Used for authentication.

| Possible Values                                                         | Default in Development | Default in Production |
| ----------------------------------------------------------------------- | ---------------------- | --------------------- |
| `api.dev.firebolt.io`, `api.staging.firebolt.io`, `api.app.firebolt.io` | N/A                    | N/A                   |

## `CUBEJS_FIREBOLT_ENGINE_NAME`

The [name of the Firebolt engine][firebolt-docs-engine-name] to connect to.

| Possible Values                                           | Default in Development | Default in Production |
| --------------------------------------------------------- | ---------------------- | --------------------- |
| A valid [Firebolt engine name][firebolt-docs-engine-name] | N/A                    | N/A                   |

## `CUBEJS_GH_API_TOKEN`

A [GitHub Personal Access Token][gh-docs-pat] to avoid API rate limiting when
downloading Cube Store.

| Possible Values    | Default in Development | Default in Production |
| ------------------ | ---------------------- | --------------------- |
| A valid GitHub PAT | `false`                | `false`               |

## `CUBEJS_JWK_URL`

Enables [JSON Web Key (JWK)][ietf-jwk-ref]-based authentication in Cube.

| Possible Values                   | Default in Development | Default in Production |
| --------------------------------- | ---------------------- | --------------------- |
| A valid URL to a JSON Web Key Set | N/A                    | N/A                   |

It can be also set as `jwkUrl` in the [`jwt` configuration
option](/reference/configuration/config#jwt).

## `CUBEJS_JWT_ALGS`

[Any supported algorithm for decoding JWTs][gh-jsonwebtoken-algs].

| Possible Values  | Default in Development | Default in Production |
| ---------------- | ---------------------- | --------------------- |
| `HS256`, `RS256` | N/A                    | N/A                   |

It can be also set as `algorithms` in the [`jwt` configuration
option](/reference/configuration/config#jwt).

## `CUBEJS_JWT_AUDIENCE`

An audience value which will be used to enforce the [`aud` claim from inbound
JWTs][ietf-jwt-ref-aud].

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid `aud` claim | N/A                    | N/A                   |

It can be also set as `audience` in the [`jwt` configuration
option](/reference/configuration/config#jwt).

## `CUBEJS_JWT_CLAIMS_NAMESPACE`

A namespace within the decoded JWT under which any custom claims can be found.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string  | N/A                    | N/A                   |

It can be also set as `claimsNamespace` in the [`jwt` configuration
option](/reference/configuration/config#jwt).

## `CUBEJS_JWT_ISSUER`

An issuer value which will be used to enforce the [`iss` claim from inbound
JWTs][ietf-jwt-ref-iss].

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid `iss` claim | N/A                    | N/A                   |

It can be also set as `issuer` in the [`jwt` configuration
option](/reference/configuration/config#jwt).

## `CUBEJS_JWT_KEY`

The secret key used to sign and verify JWTs. Similar to
[`CUBEJS_API_SECRET`](/reference/configuration/environment-variables#cubejs_api_secret).

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string  | N/A                    | N/A                   |

It can be also set as `key` in the [`jwt` configuration
option](/reference/configuration/config#jwt).

## `CUBEJS_JWT_SUBJECT`

A subject value which will be used to enforce the [`sub` claim from inbound
JWTs][ietf-jwt-ref-sub].

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid `sub` claim | N/A                    | N/A                   |

It can be also set as `subject` in the [`jwt` configuration
option](/reference/configuration/config#jwt).

## `CUBEJS_LOG_LEVEL`

The logging level for Cube.

| Possible Values                  | Default in Development | Default in Production |
| -------------------------------- | ---------------------- | --------------------- |
| `error`, `info`, `trace`, `warn` | `warn`                 | `warn`                |

<Note>

In production, Cube emits logs as structured JSON — one JSON object per line,
each including a `level` field with the log level. In development, logs are
emitted as human-readable text.

</Note>

See also `CUBESTORE_LOG_LEVEL`.
See also the [`logger` configuration option](/reference/configuration/config#logger).

## `CUBEJS_MAX_PARTITIONS_PER_CUBE`

The maximum number of partitions each pre-aggregation in a cube can use.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | `10000`                | `10000`               |

## `CUBEJS_PG_SQL_PORT`

The port used by the [SQL API][ref-sql-api] to listen to Postgres-compatible
connections on.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | N/A                    | N/A                   |

## `CUBEJS_PRE_AGGREGATIONS_BUILDER`

If `true`, this instance of Cube will build pre-aggregations, even if it is an
API instance.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `false`               |

<Info>

If Cube is configured to act as a refresh worker instance using [`CUBEJS_REFRESH_WORKER`](/reference/configuration/environment-variables#cubejs_refresh_worker),
then [`CUBEJS_PRE_AGGREGATIONS_BUILDER`](/reference/configuration/environment-variables#cubejs_pre_aggregations_builder) will be `true`.

</Info>

## `CUBEJS_PRE_AGGREGATIONS_SCHEMA`

The [database schema name](/reference/configuration/config#pre_aggregations_schema)
to use for storing pre-aggregations.

| Possible Values | Default in Development | Default in Production   |
| --------------- | ---------------------- | ----------------------- |
| A valid string  | `dev_pre_aggregations` | `prod_pre_aggregations` |

It can be also set using the [`pre_aggregations_schema` configuration
option](/reference/configuration/config#pre_aggregations_schema).

<Info>

In Cube Cloud, all [environments][ref-environments] share the same pre-aggregations schema name by default.
This allows reusing pre-aggregations across environments, saving both time and cost.

</Info>

## `CUBEJS_PRE_AGGREGATIONS_DB_*`

Connection variables for a dedicated data source used to build and store the default
data source's pre-aggregations, instead of its own connection. They mirror the regular
`CUBEJS_DB_*` connection variables — for example `CUBEJS_PRE_AGGREGATIONS_DB_HOST`,
`CUBEJS_PRE_AGGREGATIONS_DB_PORT`, `CUBEJS_PRE_AGGREGATIONS_DB_USER`,
`CUBEJS_PRE_AGGREGATIONS_DB_PASS`, and `CUBEJS_PRE_AGGREGATIONS_DB_SSL`. For a [named data source][ref-config-multiple-ds-decorating-env],
use the decorated form `CUBEJS_DS_<NAME>_PRE_AGGREGATIONS_DB_*`.

Driver-specific connection variables take the same segment, so the dedicated connection
is not limited to the `_DB_*` family — for example `CUBEJS_PRE_AGGREGATIONS_JDBC_URL`,
`CUBEJS_PRE_AGGREGATIONS_AWS_REGION`, and `CUBEJS_PRE_AGGREGATIONS_FIREBOLT_ENGINE_NAME`.
In the decorated form for a named data source, the `DB_`, `JDBC_`, `AWS_`, `DATABASE`,
and `FIREBOLT_` variable families are supported.

| Possible Values                                  | Default in Development | Default in Production |
| ------------------------------------------------ | ---------------------- | --------------------- |
| Same as the corresponding `CUBEJS_DB_*` variable | Not set                | Not set               |

Setting any one of these variables switches the data source's pre-aggregations onto the
dedicated connection. Configure it in full: an unset variable falls back to the driver's
default rather than to its `CUBEJS_DB_*` counterpart. `CUBEJS_PRE_AGGREGATIONS_DB_TYPE` is
ignored — the dedicated connection always uses the data source's driver. A custom
[`driver_factory`][ref-config-driver-factory] takes precedence over these variables.

See [pre-aggregation data source][ref-preagg-data-source] for details and examples.

## `CUBEJS_PRE_AGGREGATIONS_ALLOW_NON_STRICT_DATE_RANGE_MATCH`

If `true`, allows non-strict date range matching for pre-aggregations by default.
This can be overridden for individual pre-aggregations using the
[`allow_non_strict_date_range_match`][ref-schema-ref-preagg-allownonstrict] parameter.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                | `true`                |

## `CUBEJS_PRE_AGGREGATIONS_BACKOFF_MAX_TIME`

The maximum time, in seconds, for exponential backoff for retries when pre-aggregation
builds fail. When a pre-aggregation refresh fails, retries will be executed with
exponentially increasing delays, but the delay will not exceed the value specified by
this variable.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid number in seconds | `600`                  | `600`                 |

## `CUBEJS_REFRESH_KEY_LOCAL_TIME`

To check an `every`-based [`refresh_key`](/reference/data-modeling/cube#refresh_key), Cube
asks the database what time it is. If `true`, it uses its own clock instead and those
queries stop entirely, including the ones scheduled refresh issues to warm them.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

Cube already caches each result for a fraction of the interval, so this is not one query
saved per request — it is one per refresh key per renewal window, multiplied by every cube,
tenant, and timezone in the deployment.

Refresh keys written with `sql` or marked
[`incremental`](/reference/data-modeling/pre-aggregations#incremental) keep querying the
database, since their values depend on your data and not just on the time. So do all
refresh keys if you have set
[`queryCacheOptions.refreshKeyRenewalThreshold`][ref-config-query-cache-options], which
works by caching the query result.

<Warning>

Cube now trusts each machine's clock, so they all have to agree. Set this variable to the
same value on **every** API instance and refresh worker and keep them synchronized with
NTP. Instances on opposite sides of an interval boundary compute different refresh keys,
which can build the same pre-aggregation twice.

</Warning>

## `CUBEJS_REFRESH_WORKER`

If `true`, this instance of Cube will **only** refresh pre-aggregations.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_ROLLUP_ONLY`

If `true`, the API instance of Cube will **only** fulfill queries from
pre-aggregations. See [rollup-only
mode](/docs/pre-aggregations/using-pre-aggregations#rollup-only-mode) for details.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

It can be also set using the [`orchestrator_options.rollupOnlyMode` configuration
option](/reference/configuration/config#orchestrator_options).

## `CUBEJS_SCHEDULED_REFRESH_TIMEZONES`

A comma-separated [list of timezones to schedule refreshes
for][ref-config-sched-refresh-timer].

| Possible Values                                           | Default in Development | Default in Production |
| --------------------------------------------------------- | ---------------------- | --------------------- |
| [A valid timezone from the tz database][wiki-tz-database] | N/A                    | N/A                   |

<Warning>

An invalid value fails at server startup. Only TZ Database names are accepted — fixed
UTC offsets such as `+05:00` are rejected.

</Warning>

It can be also set using the [`scheduled_refresh_time_zones` configuration
option](/reference/configuration/config#scheduled_refresh_time_zones).

## `CUBEJS_SCHEMA_PATH`

The path where Cube loads data models from.

| Possible Values                          | Default in Development | Default in Production |
| ---------------------------------------- | ---------------------- | --------------------- |
| A valid path containing Cube data models | `model`                | `model`               |

<Info>

Until v0.35, the default value was `schema`.

</Info>

It can be also set using the [`schema_path` configuration
option](/reference/configuration/config#schema_path).

## `CUBEJS_SERVER_HEADERS_TIMEOUT`

The number of milliseconds to limit the amount of time the parser will wait
to receive the complete HTTP headers.
If the timeout expires, the server responds with status 408 without
forwarding the request to the request listener and then closes the connection.

| Possible Values                           | Default in Development   | Default in Production    |
| ----------------------------------------- | ------------------------ | ------------------------ |
| A valid number or string representing one | NodeJS's version default | NodeJS's version default |

## `CUBEJS_SERVER_KEEP_ALIVE_TIMEOUT`

The number of milliseconds of inactivity a server needs to wait for additional incoming data,
after it has finished writing the last response, before a socket will be destroyed.

| Possible Values                           | Default in Development   | Default in Production    |
| ----------------------------------------- | ------------------------ | ------------------------ |
| A valid number or string representing one | NodeJS's version default | NodeJS's version default |

## `CUBEJS_MAX_REQUEST_SIZE`

The maximum allowed size for incoming requests. Applies to both HTTP body parser
and WebSocket message payload limits. Must be between `100kb` and `64mb`.

| Possible Values                                   | Default in Development | Default in Production |
| ------------------------------------------------- | ---------------------- | --------------------- |
| A size string between 100kb and 64mb (e.g., 1mb)  | `50mb`                 | `50mb`                |

## `CUBEJS_SQL_USER`

A username required to access the [SQL API][ref-sql-api].

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string  | N/A                    | N/A                   |

See also the [`check_sql_auth` configuration
option](/reference/configuration/config#check_sql_auth).

## `CUBEJS_SQL_PASSWORD`

A password required to access the [SQL API][ref-sql-api].

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string  | N/A                    | N/A                   |

See also the [`check_sql_auth` configuration
option](/reference/configuration/config#check_sql_auth).

## `CUBEJS_SQL_SUPER_USER`

A name of specific user who will be allowed to change the user during the SQL API
session.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string  | N/A                    | N/A                   |

See also the [`can_switch_sql_user` configuration
option](/reference/configuration/config#can_switch_sql_user).

## `CUBEJS_ALLOW_UNGROUPED_WITHOUT_PRIMARY_KEY`

If `true`, disables the primary key inclusion check for
[ungrouped queries](/reference/core-data-apis/queries#ungrouped-query).

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

It can be also set using the [`allow_ungrouped_without_primary_key` configuration
option](/reference/configuration/config#allow_ungrouped_without_primary_key).

<Info>

When query push-down in the SQL API is enabled via the `CUBESQL_SQL_PUSH_DOWN`
environment variable, this option is enabled as well for the best user experience.

</Info>

## `CUBESQL_SQL_PUSH_DOWN`

If `true`, enables query pushdown in the [SQL API][ref-sql-api].

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

## `CUBESQL_STREAM_MODE`

If `true`, enables the [streaming mode][ref-sql-api-streaming] in the [SQL API][ref-sql-api].
When enabled, SQL API queries with no `LIMIT` clause, or with one above the maximum row
limit set by
[`CUBESQL_NON_STREAMING_QUERY_MAX_ROW_LIMIT`](#cubesql_non_streaming_query_max_row_limit),
are streamed instead and aren't capped by it.
Queries with a `LIMIT` at or below that limit are not streamed.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBESQL_FAIL_ON_LIMITLESS_POST_PROCESSING`

If `true`, the [SQL API][ref-sql-api] rejects a query when part of it has to run outside
the data source over a Cube query with no `LIMIT` clause, or with one above the maximum
row limit set by
[`CUBESQL_NON_STREAMING_QUERY_MAX_ROW_LIMIT`](#cubesql_non_streaming_query_max_row_limit).

Such a query is capped at that limit, without any ordering, and a `LIMIT` above it is
clamped back down to it. Sorting, filtering, or joining that capped result outside the
data source treats an arbitrary slice of the rows as if it were the whole population, so
the answer is wrong rather than merely short. The SQL API pushes these queries down to
the data source whenever it can; this option controls what happens when it cannot. Leave
it `false` to keep returning the truncated result, or set it to `true` to fail with an
error instead.

Queries that are streamed (see [`CUBESQL_STREAM_MODE`](#cubesql_stream_mode)) are never
capped, so this option has no effect on them.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBESQL_CUBE_SCAN_MAX_BATCH_ROWS`

Specifies the maximum number of rows in a single record batch produced when the
[SQL API][ref-sql-api] reads data from a cube. Larger result sets are split into
several batches, which lets downstream consumers process them incrementally
instead of materializing the whole result set at once. In particular, the
[`/v1/cubesql`][ref-ref-cubesql] endpoint emits one newline-delimited JSON chunk
per batch.

Set to `0` to disable splitting.

| Possible Values                | Default in Development | Default in Production |
| ------------------------------ | ---------------------- | --------------------- |
| A non-negative integer number  | `65536`                | `65536`               |

## `CUBESQL_NON_STREAMING_QUERY_MAX_ROW_LIMIT`

The maximum [row limit][ref-row-limit] for [SQL API][ref-sql-api] queries that are
not streamed. A larger `LIMIT` is reduced to this value, unless
[streaming mode][ref-sql-api-streaming] is enabled, in which case the query is
streamed instead.

| Possible Values           | Default in Development                            | Default in Production                             |
| ------------------------- | ------------------------------------------------- | ------------------------------------------------- |
| A positive integer number | [`CUBEJS_DB_QUERY_LIMIT`](#cubejs_db_query_limit) (`50000`) | [`CUBEJS_DB_QUERY_LIMIT`](#cubejs_db_query_limit) (`50000`) |

Set it below `CUBEJS_DB_QUERY_LIMIT` to let other APIs return large result sets
while keeping SQL API responses small enough to fit in a single batch, or streamed
if streaming mode is enabled. Buffering very large non-streamed responses can
exhaust memory and break the client connection.

<Warning>

This value cannot exceed [`CUBEJS_DB_QUERY_LIMIT`](#cubejs_db_query_limit). If you
set it higher, Cube logs a warning at startup and falls back to
`CUBEJS_DB_QUERY_LIMIT`, because non-streamed queries above that limit are rejected
before they reach the data source.

</Warning>

## `CUBESQL_SQL_NO_IMPLICIT_ORDER`

If `true`, prevents adding implicit [default `ORDER BY`
clause](/reference/core-data-apis/queries#order) for [SQL API][ref-sql-api] queries.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

## `CUBEJS_MAX_SESSIONS`

Specifies the maximum number of concurrent sessions (connections) to the
[SQL API][ref-sql-api] and safeguards your Cube deployment from out-of-memory
crashes when too many connections are attempted to be established.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | 1024                   | 1024                  |

## `CUBESQL_REWRITE_MAX_NODES`

Specifies the maximum number of e-graph nodes that are allocated during
the creation of a query plan in the [SQL API][ref-sql-api].

Should be increased if you get the following error:
`Error during rewrite: Can't find rewrite due to 10002 AST node limit reached.`

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | 10000                  | 10000                 |

## `CUBESQL_REWRITE_MAX_ITERATIONS`

Specifies the maximum number of e-graph term rewriting iterations that are performed
during the creation of a query plan in the [SQL API][ref-sql-api].

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | 300                    | 300                   |

## `CUBESQL_REWRITE_TIMEOUT`

Specifies the maximum time, in seconds, that is allocated for
the creation of a query plan in the [SQL API][ref-sql-api].

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | 30                     | 30                    |

## `CUBESQL_AUTH_EXPIRE_SECS`

Number of seconds before session's SQL API security context will be invalidated.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid integer number | `300`                 | `300`                |

## `CUBEJS_DAX_CREATE_DATE_HIERARCHIES`

If `true`, the DAX API will expose time dimensions as calendar hierarchies.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true` | `true` |

## `CUBEJS_DAX_SINGLE_PERSPECTIVE`

If `true`, the DAX API exposes all views as part of a single
perspective, enabling cross-view filtering.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false` | `false` |

## `CUBE_XMLA_LANGUAGE`

This variable is used to [configure the locale][ref-mdx-api-locale] for the [MDX API][ref-mdx-api].

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| Either a [LCID][link-lcid] (numeric) or a language tag (string) | `1033` (English - United States) | `1033` (English - United States) |

For example, to display currency values using the Netherlands locale (euro with comma as decimal separator), you can use either:

```bash
# LCID
CUBE_XMLA_LANGUAGE=1043

# Language tag
CUBE_XMLA_LANGUAGE=nl-NL
```

[link-lcid]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f

## `CUBE_MDX_CREATE_DATE_HIERARCHIES`

If `true`, the [MDX API][ref-mdx-api] will automatically create additional hierarchies for all [time dimensions][ref-time-dimensions] and organize them in a separate "Calendar" folder for each dimension.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

## `CUBEJS_NESTED_FOLDERS_DELIMITER`

Specifies the delimiter used to flatten the names of nested [folder][ref-folders] in
views when [visualization tools][ref-dataviz-tools] do not support nested folder
structures. When set, nested folders will be presented at the root level with path-like
names using the specified delimiter.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid string delimiter (e.g., ` / `) | N/A | N/A |

For example, if set to `/`, a nested folder structure like the `Customer Information`
folder with the `Personal Details` subfolder will be flattened to `Customer
Information / Personal Details` at the root level.

## `CUBEJS_TELEMETRY`

If `true`, then send telemetry to Cube.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

## `CUBESTORE_METRICS_FORMAT`

Define which metrics collector format.

| Possible Values       | Default in Development | Default in Production |
| --------------------- | ---------------------- | --------------------- |
| `statsd`, `dogstatsd` | `statsd`               | `statsd`              |

## `CUBESTORE_METRICS_ADDRESS`

Required IP address to send metrics.

| Possible Values    | Default in Development | Default in Production |
| ------------------ | ---------------------- | --------------------- |
| A valid IP address | `127.0.0.1`            | `127.0.0.1`           |

## `CUBESTORE_METRICS_PORT`

Required port to send where collector server accept UDP connections.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | `8125`                 | `8125`                |

## `CUBEJS_TOUCH_PRE_AGG_TIMEOUT`

<Warning>

If the refresh worker’s throughput isn’t sufficient and the Cube Refresh Worker can’t refresh every partition, Cube will start dropping partitions once the timeout is reached.
For externally refreshed pre-aggregations, make sure each pre-aggregation is refreshed at least once within the specified timeout period.

</Warning>

The number of seconds without a touch before pre-aggregation is considered
orphaned and marked for removal. Please see
[`CUBEJS_DROP_PRE_AGG_WITHOUT_TOUCH`](/reference/configuration/environment-variables#cubejs_drop_pre_agg_without_touch) to
learn more.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | 86400                  | 86400                 |

## `CUBEJS_WEB_SOCKETS`

If `true`, then use WebSocket for data fetching.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBEJS_TESSERACT_SQL_PLANNER`

Enables Tesseract, the [next-generation data modeling engine][link-tesseract],
which is the default SQL planner and powers
[multi-stage calculations][ref-multi-stage-calculations]. In versions before v1.7.0,
Tesseract was not enabled by default. Set to `false` to fall back to the legacy
planner, which is deprecated and will be removed in the near future.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

Tesseract-based pre-aggregation matching and planning follows this flag and cannot be
toggled independently.

## `CUBESTORE_AWS_ACCESS_KEY_ID`

The Access Key ID for AWS. Required when using AWS S3.

| Possible Values                             | Default in Development | Default in Production |
| ------------------------------------------- | ---------------------- | --------------------- |
| [A valid AWS Access Key ID][aws-docs-creds] | N/A                    | N/A                   |

## `CUBESTORE_AWS_SECRET_ACCESS_KEY`

The Secret Access Key for AWS. Required when using AWS S3.

| Possible Values                                 | Default in Development | Default in Production |
| ----------------------------------------------- | ---------------------- | --------------------- |
| [A valid AWS Secret Access Key][aws-docs-creds] | N/A                    | N/A                   |

## `CUBESTORE_AWS_CREDS_REFRESH_EVERY_MINS`

The number of minutes after which Cube Store should refresh AWS credentials.
Required when using an AWS instance role.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid number in minutes | `180`                  | `180`                 |

## `CUBESTORE_AWS_WEB_IDENTITY_TOKEN_FILE`

The path to an AWS web identity token file. When `CUBESTORE_AWS_ACCESS_KEY_ID` is
not set and this variable is present, Cube Store authenticates to S3 using AWS Web
Identity (for example, [IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html)
on Amazon EKS): it exchanges the token for
temporary credentials via STS `AssumeRoleWithWebIdentity` and re-exchanges them
when the token file changes.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid file path | N/A                  | N/A                   |

## `CUBESTORE_AWS_ROLE_ARN`

The ARN of the AWS IAM role to assume when using
[`CUBESTORE_AWS_WEB_IDENTITY_TOKEN_FILE`](#cubestore_aws_web_identity_token_file).

| Possible Values   | Default in Development | Default in Production |
| ----------------- | ---------------------- | --------------------- |
| A valid IAM role ARN | N/A                 | N/A                   |

## `CUBESTORE_BIND_ADDR`

The address/port pair for Cube Store's MySQL-compatible interface.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid address/port pair | `0.0.0.0:3306`         | `0.0.0.0:3306`        |

## `CUBESTORE_CACHE_MAX_ENTRY_SIZE`

The maximum size of a single entry in Cube Store's
[cache store](/docs/pre-aggregations/cube-store-architecture#cache-and-queue-store).
Larger entries are rejected. Cannot exceed
[`CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE`](#cubestore_transport_max_message_size)
minus 1 MiB.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A size, e.g. `63MiB` | `63MiB`           | `63MiB`               |

## `CUBESTORE_DATA_DIR`

A path on the local filesystem to store a local replica of the data. Must be
unique on each node and different from `CUBESTORE_REMOTE_DIR`.

| Possible Values                                             | Default in Development | Default in Production |
| ----------------------------------------------------------- | ---------------------- | --------------------- |
| A valid path on the local filesystem with read/write access | `.cubestore/data`      | `.cubestore/data`     |

## `CUBESTORE_GCP_CREDENTIALS`

A Base64-encoded JSON key for connecting to Google Cloud. Required when
using Google Cloud Storage

| Possible Values                                                                 | Default in Development | Default in Production |
| ------------------------------------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Google Cloud JSON key encoded as a Base64 string][gcp-docs-creds-json] | N/A                    | N/A                   |

## `CUBESTORE_GCP_KEY_FILE`

The path to a JSON key file for connecting to Google Cloud. Required when using
Google Cloud Storage.

| Possible Values                                           | Default in Development | Default in Production |
| --------------------------------------------------------- | ---------------------- | --------------------- |
| [A valid Google Cloud JSON key file][gcp-docs-creds-json] | N/A                    | N/A                   |

## `CUBESTORE_GCS_BUCKET`

The name of a bucket in GCS. Required when using GCS

| Possible Values                                 | Default in Development | Default in Production |
| ----------------------------------------------- | ---------------------- | --------------------- |
| A valid bucket name in the Google Cloud account | N/A                    | N/A                   |

## `CUBESTORE_GCS_SUB_PATH`

The path in a GCS bucket to store pre-aggregations. Optional

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid path prefix | N/A                    | N/A                   |

## `CUBESTORE_HTTP_BIND_ADDR`

The address/port pair for Cube Store's HTTP interface.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid address/port pair | `0.0.0.0:3030`         | `0.0.0.0:3030`        |

## `CUBESTORE_HTTP_PORT`

The port for Cube Store to listen to HTTP connections on. Ignored when
`CUBESTORE_HTTP_BIND_ADDR` is set.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | `3030`                 | `3030`                |

## `CUBESTORE_JOB_RUNNERS`

The number of parallel tasks that process non-interactive jobs like data
insertion, compaction etc.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | `4`                    | `4`                   |

## `CUBESTORE_LOG_LEVEL`

The logging level for Cube Store.

| Possible Values                           | Default in Development | Default in Production |
| ----------------------------------------- | ---------------------- | --------------------- |
| `error`, `warn`, `info`, `debug`, `trace` | `error`                | `error`               |

See also [`CUBEJS_LOG_LEVEL`](/reference/configuration/environment-variables#cubejs_log_level).

## `CUBESTORE_MAX_WS_CONNECTIONS_PER_USER`

The maximum number of concurrent WebSocket connections a single authenticated
user may hold. At the limit, that user's oldest connection is closed to admit the
new one: a client that still needs it reconnects, while one that had forgotten
about it simply loses it. The limit is counted per Cube Store node, so a user
connecting to several nodes may hold up to this many on each.

Use it to keep one client that leaks connections from exhausting the node's file
descriptors for everyone else. Set it comfortably above the number of connections
a client legitimately keeps open at once, or working connections will be recycled.
`0` disables the limit.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A non-negative integer    | `0`                    | `0`                   |

## `CUBESTORE_META_ADDR`

The address/port pair for the Cube Store **router** node in the cluster.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid address/port pair | N/A                    | N/A                   |

## `CUBESTORE_META_PORT`

The port for the Cube Store **router** node to listen for connections on.
Ignored when `CUBESTORE_META_ADDR` is set.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | N/A                    | N/A                   |

## `CUBESTORE_MINIO_ACCESS_KEY_ID`

The Access Key ID for MinIO. Required when using MinIO.

| Possible Values             | Default in Development | Default in Production |
| --------------------------- | ---------------------- | --------------------- |
| A valid MinIO Access Key ID | N/A                    | N/A                   |

## `CUBESTORE_MINIO_BUCKET`

The name of the bucket that you want to use MinIO. Required when using MinIO.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid bucket name | N/A                    | N/A                   |

## `CUBESTORE_MINIO_SUB_PATH`

The name of sub path (folder) inside the bucket that you want to use. Required when using MinIO.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid sub path (folder) name | N/A                    | N/A                   |

## `CUBESTORE_MINIO_CREDS_REFRESH_EVERY_MINS`

The number of minutes after which Cube Store should refresh MinIO credentials.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid number in minutes | `180`                  | `180`                 |

## `CUBESTORE_MINIO_REGION`

The region of a bucket in AWS. Optional when using MinIO.

| Possible Values                                        | Default in Development | Default in Production |
| ------------------------------------------------------ | ---------------------- | --------------------- |
| A valid S3 region name, an empty string if not present | N/A                    | N/A                   |

## `CUBESTORE_MINIO_SECRET_ACCESS_KEY`

The Secret Access Key for MinIO. Required when using MinIO.

| Possible Values                 | Default in Development | Default in Production |
| ------------------------------- | ---------------------- | --------------------- |
| A valid MinIO Secret Access Key | N/A                    | N/A                   |

## `CUBESTORE_MINIO_SERVER_ENDPOINT`

The MinIO server endpoint. Required when using MinIO.

| Possible Values        | Default in Development | Default in Production |
| ---------------------- | ---------------------- | --------------------- |
| A valid MinIO endpoint | N/A                    | N/A                   |

```dotenv
CUBESTORE_MINIO_SERVER_ENDPOINT=http://localhost:9000
```

## `CUBESTORE_NO_UPLOAD`

If `true`, prevents uploading serialized pre-aggregations to cloud storage.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `CUBESTORE_PORT`

The port for Cube Store to listen to connections on. Ignored when
`CUBESTORE_BIND_ADDR` is set.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | `3306`                 | `3306`                |

## `CUBESTORE_QUERY_TIMEOUT`

The timeout for SQL queries in seconds.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A number in seconds | `120`                  | `120`                 |

## `CUBESTORE_QUERY_CACHE_STALE_WHILE_REVALIDATE`

Enables stale-while-revalidate behavior for Cube Store's SQL result cache. When set
to a number of seconds, a cached result that has expired is still served for up to
that many seconds while the cache is refreshed in the background. Set to `0` to
disable.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A number in seconds | `0`                    | `0`                   |

## `CUBESTORE_REMOTE_DIR`

A path on the local filesystem to store metadata and datasets from all nodes as
if it were remote storage. Not required if using GCS/S3. Not recommended for
production usage

| Possible Values                                             | Default in Development | Default in Production |
| ----------------------------------------------------------- | ---------------------- | --------------------- |
| A valid path on the local filesystem with read/write access | N/A                    | N/A                   |

## `CUBESTORE_S3_BUCKET`

The name of a bucket in AWS S3. Required when using AWS S3.

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| A valid bucket name in the AWS account | N/A                    | N/A                   |

## `CUBESTORE_S3_REGION`

| The region of a bucket in AWS S3. Required when using AWS S3.

| Possible Values                        | Default in Development | Default in Production |
| -------------------------------------- | ---------------------- | --------------------- |
| [A valid AWS region][aws-docs-regions] | N/A                    | N/A                   |

## `CUBESTORE_S3_SSE`

When set, Cube Store sends the `x-amz-server-side-encryption` header with this
value on every AWS S3 request. Optional. Useful when an AWS Organizations
service control policy denies `s3:PutObject` requests that lack this header,
even if the bucket has default encryption enabled.

| Possible Values                   | Default in Development | Default in Production |
| --------------------------------- | ---------------------- | --------------------- |
| `AES256`, `aws:kms`, `aws:kms:dsse` | N/A                    | N/A                   |

## `CUBESTORE_S3_SUB_PATH`

The path in a AWS S3 bucket to store pre-aggregations. Optional.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid path prefix | N/A                    | N/A                   |

## `CUBESTORE_SELECT_WORKERS`

The number of Cube Store sub-processes that handle `SELECT` queries.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | `4`                    | `4`                   |

## `CUBESTORE_SERVER_NAME`

The full name and port number of the Cube Store node (either the router
or a worker). Must be unique for each instance in the Cube Store cluster.

Should be passed to the Cube Store router and to each Cube Store worker.

| Possible Values           | Default in Development | Default in Production |
| ------------------------- | ---------------------- | --------------------- |
| A valid address/port pair | `localhost`            | `localhost`           |

## `CUBESTORE_TELEMETRY`

If `true`, then sends telemetry to Cube.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `true`                 | `true`                |

## `CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE`

The maximum size of a single message on the WebSocket connection between Cube
and Cube Store. Messages above this size are answered with an error; see
[message size limits](/docs/pre-aggregations/cube-store-architecture#message-size-limits).

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A size from `16MiB` to `256MiB` | `64MiB` | `64MiB`     |

## `CUBESTORE_TRANSPORT_MAX_FRAME_SIZE`

The maximum size of a single WebSocket frame on the connection between Cube
and Cube Store. A message is split into frames, so this can be smaller than
[`CUBESTORE_TRANSPORT_MAX_MESSAGE_SIZE`](#cubestore_transport_max_message_size).

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A size from `4MiB` to `256MiB` | `64MiB`  | `64MiB`              |

## `CUBESTORE_WAL_SPLIT_THRESHOLD`

The maximum number of rows to keep in a single chunk of data right after
insertion.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | `262144`               | `262144`              |

## `CUBESTORE_CHUNKS_COUNT_THRESHOLD`

The number of chunks a partition can accumulate before Cube Store compacts them into
a single chunk.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | `4`                    | `4`                   |

## `CUBESTORE_COMPACTION_READINESS_CHUNKS_THRESHOLD`

The number of chunks at which a table's partitions are considered ready during table
creation. When set, it must not be lower than
[`CUBESTORE_CHUNKS_COUNT_THRESHOLD`](#cubestore_chunks_count_threshold), otherwise
compaction would never reduce the number of chunks below this threshold. By default,
it is not set.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| A valid number  | N/A                    | N/A                   |

## `CUBESTORE_WORKER_PORT`

The port for Cube Store workers to listen to connections on. When set, the node
will start as a Cube Store **worker** in the cluster

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | N/A                    | N/A                   |

## `CUBESTORE_WORKERS`

A comma-separated list of address/port pairs of Cube Store workers.

Should be passed to the Cube Store router and to each Cube Store worker.

| Possible Values                              | Default in Development | Default in Production |
| -------------------------------------------- | ---------------------- | --------------------- |
| A comma-separated list of address/port pairs | N/A                    | N/A                   |

```dotenv
CUBESTORE_WORKERS=worker-1:3123,localhost:3124,123.124.125.128:3123
```

Used to implement stateless addressing within a Cube Store cluster.
By analyzing `CUBESTORE_WORKERS` and `CUBESTORE_SERVER_NAME`, each node
is able to determine its position within a Cube Store cluster.
This allows each worker to know which pre-aggregation partitions it owns
and how the load is distributed across all workers.

## `DEBUG_LOG`

If `true`, enables debug logging.

| Possible Values | Default in Development | Default in Production |
| --------------- | ---------------------- | --------------------- |
| `true`, `false` | `false`                | `false`               |

## `PORT`

The port for a Cube deployment to listen to API connections on.

| Possible Values     | Default in Development | Default in Production |
| ------------------- | ---------------------- | --------------------- |
| A valid port number | `4000`                 | `4000`                |

[aws-athena]: https://aws.amazon.com/athena
[aws-athena-workgroup]:
  https://docs.aws.amazon.com/athena/latest/ug/workgroups-benefits.html
[aws-athena-catalog]:
  https://docs.aws.amazon.com/athena/latest/ug/understanding-tables-databases-and-the-data-catalog.html
[aws-docs-creds]:
  https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys
[aws-docs-regions]:
  https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#concepts-available-regions
[aws-docs-vpc-endpoints]:
  https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
[bq-docs-regional-locations]:
  https://cloud.google.com/bigquery/docs/locations#regional-locations
[databricks-docs-dbfs]:
  https://docs.databricks.com/data/databricks-file-system.html#mount-object-storage-to-dbfs
[databricks-docs-pat]:
  https://docs.databricks.com/dev-tools/api/latest/authentication.html#token-management
[firebolt-docs-account-name]:
  https://docs.firebolt.io/managing-your-account/concepts-and-terminology.html#firebolt-account
[firebolt-docs-engine-name]:
  https://docs.firebolt.io/working-with-engines/understanding-engine-fundamentals.html#engine-name
[gcp-docs-creds-json]:
  https://cloud.google.com/iam/docs/creating-managing-service-account-keys
[gh-docs-pat]:
  https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
[gh-jsonwebtoken-algs]:
  https://github.com/auth0/node-jsonwebtoken#algorithms-supported
[ietf-jwk-ref]: https://tools.ietf.org/html/rfc7517#section-4
[ietf-jwt-ref-iss]: https://tools.ietf.org/html/rfc7519#section-4.1.1
[ietf-jwt-ref-sub]: https://tools.ietf.org/html/rfc7519#section-4.1.2
[ietf-jwt-ref-aud]: https://tools.ietf.org/html/rfc7519#section-4.1.3
[motherduck-docs-svc-token]:
  https://motherduck.com/docs/authenticating-to-motherduck/#authentication-using-a-service-token
[ref-config-db]: /admin/connect-to-data/data-sources
[ref-config-driver-factory]: /reference/configuration/config#driver_factory
[ref-config-query-cache-options]: /reference/configuration/config#orchestrator_options
[ref-config-multiple-ds-cloud]: /admin/connect-to-data/multiple-data-sources
[ref-config-multiple-ds-decorating-env]: /admin/connect-to-data/multiple-data-sources#under-the-hood
[ref-preagg-data-source]: /docs/pre-aggregations/refreshing-pre-aggregations#pre-aggregation-data-source
[ref-config-sched-refresh-timer]: /reference/configuration/config#scheduled_refresh_timer
[ref-rest-scopes]: /reference/core-data-apis/rest-api#configuration-api-scopes
[snowflake-docs-account-id]:
  https://docs.snowflake.com/en/user-guide/admin-account-identifier.html
[snowflake-docs-connection-options]:
  https://docs.snowflake.com/en/user-guide/nodejs-driver-use.html#additional-connection-options
[snowflake-docs-regions]:
  https://docs.snowflake.com/en/user-guide/intro-regions.html
[snowflake-docs-roles]:
  https://docs.snowflake.com/en/user-guide/security-access-control-overview.html#roles
[snowflake-docs-warehouse]:
  https://docs.snowflake.com/en/user-guide/warehouses.html
[wiki-tz-database]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
[ref-sql-api]: /reference/core-data-apis/sql-api
[ref-sql-api-streaming]: /reference/core-data-apis/sql-api#streaming
[ref-ref-cubesql]: /reference/core-data-apis/rest-api/reference#base_path/v1/cubesql
[ref-row-limit]: /reference/core-data-apis/queries#row-limit
[mysql-server-tz-support]: https://dev.mysql.com/doc/refman/8.4/en/time-zone-support.html
[ref-schema-ref-preagg-allownonstrict]: /reference/data-modeling/pre-aggregations#allow_non_strict_date_range_match
[link-tesseract]: https://cube.dev/blog/introducing-next-generation-data-modeling-engine
[ref-multi-stage-calculations]: /docs/data-modeling/measures#multi-stage-measures
[ref-folders]: /reference/data-modeling/view#folders
[ref-dataviz-tools]: /admin/connect-to-data/visualization-tools
[ref-context-to-app-id]: /reference/configuration/config#context_to_app_id
[ref-environments]: /admin/deployment/environments
[ref-databricks-m2m-oauth]: https://docs.databricks.com/aws/en/dev-tools/auth/oauth-m2m
[ref-mdx-api]: /reference/core-data-apis/mdx-api
[ref-mdx-api-locale]: /reference/core-data-apis/mdx-api#measure-format
[ref-time-dimensions]: /reference/data-modeling/dimensions#type
[ref-time-zone]: /reference/core-data-apis/queries#time-zone
[link-tzdb]: https://en.wikipedia.org/wiki/Tz_database
[nodejs-docs-tls-options]: https://nodejs.org/docs/latest/api/tls.html#tls_tls_createsecurecontext_options
