Many settings in Metabase can be configured via environment variables. Environment variables take precedence over settings configured in the Admin Panel and are not written to the application database.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/metabase/metabase/llms.txt
Use this file to discover all available pages before exploring further.
Environment variables are ideal for production deployments as they keep sensitive configuration outside your codebase and allow different settings per environment.
How to set environment variables
The method for setting environment variables depends on how you’re running Metabase.- JAR file (Unix/Mac)
- JAR file (Windows PowerShell)
- JAR file (Windows CMD)
- Java properties
- Docker
- Docker Compose
- Systemd service
Export variables before running the JAR:
Core configuration variables
Application database
These variables configure where Metabase stores its application data.Database type for Metabase application dataOptions:
postgres, mysql, h2Example: postgresName of the application databaseExample:
metabaseDatabase server hostname or IP addressExample:
localhost or db.example.comDatabase server portDefault:
5432 (PostgreSQL), 3306 (MySQL)Database usernameExample:
metabase_userDatabase password
Full JDBC connection string (overrides individual parameters)Example:
jdbc:postgresql://localhost:5432/metabase?user=username&password=passwordPath to H2 database file (H2 only)Example:
/data/metabase.dbH2 automatically appends
.mv.db or .h2.db - don’t include these extensions.Server configuration
Hostname or IP address for the Jetty web server to bind toDefault:
localhostExample: 0.0.0.0 (listen on all interfaces)Port for the Jetty web serverDefault:
3000Enable SSL/HTTPSDefault:
falsePort for HTTPS when SSL is enabledDefault:
8443Path to Java keystore file for SSL
Password for the SSL keystore
Site settings
The name of your Metabase siteDefault:
MetabaseExample: Analytics PortalThe base URL where users access MetabaseExample:
https://analytics.company.comImportant for email links and embedding.
Default language for your Metabase instanceDefault:
enOptions: en, es, fr, de, pt, zh, ja, and moreEmail configuration
SMTP server hostnameExample:
smtp.gmail.comSMTP server portCommon values:
587 (TLS), 465 (SSL), 25 (plain)SMTP authentication username
SMTP authentication password
SMTP security protocolOptions:
none, tls, ssl, starttlsDefault: noneEmail address to use as senderDefault:
notifications@metabase.comExample: analytics@company.comDisplay name for email senderExample:
Company AnalyticsPerformance and limits
Maximum rows returned for unaggregated queriesDefault:
2000Maximum rows returned for aggregated queriesDefault:
10000Max: 1048575Row limit for file downloads (excluding header)
XLSX files are limited to 1,048,575 rows regardless of this setting.
Maximum cache size per saved question (in kilobytes)Default:
2000Maximum time to cache query results (in seconds)Default:
3024000 (35 days)Database connection timeout in millisecondsDefault:
10000 (10 seconds)Increase for SSH tunnels or slow networks.
Query execution timeout in minutesDefault:
20Maximum connection pool size for data warehousesDefault:
15Security settings
Secret key for signing embedded analytics tokens
Enable static embeddingDefault:
falseEnable interactive embeddingDefault:
falsePro/Enterprise only
Allow creating public links for questions and dashboardsDefault:
trueForce HTTPS redirect when site URL uses HTTPSDefault:
falseUse session cookies instead of persistent cookiesDefault:
falsePassword complexity requirementsOptions:
weak, normal, strongDefault: normalAuthentication
LDAP
Enable LDAP authenticationDefault:
falseLDAP server hostname
LDAP server portDefault:
389 (plain), 636 (SSL)LDAP security protocolOptions:
none, ssl, starttlsDistinguished Name for LDAP bind userExample:
cn=admin,dc=company,dc=comPassword for LDAP bind user
Base DN for user searchesExample:
ou=users,dc=company,dc=comSAML (Pro/Enterprise)
Enable SAML authenticationDefault:
falsePro/Enterprise only
SAML identity provider URL
Identity provider certificate (base64 encoded)
JWT (Pro/Enterprise)
Enable JWT authenticationDefault:
falsePro/Enterprise only
Secret for JWT token validation
URL for JWT-based login page
Docker-specific variables
Java timezone for the Metabase applicationExample:
US/Pacific, Europe/London, Asia/TokyoDefault: System timezoneUser ID for the Metabase process in DockerExample:
1000Group ID for the Metabase process in DockerExample:
1000Logging and monitoring
Days to retain audit log dataDefault:
null (keep forever)Minimum: 30 daysNote: Set to 0 to keep all dataLog health check requestsDefault:
trueHide stack traces in error responsesDefault:
falseEnable in production to avoid exposing internal details.
Feature flags
Check for new Metabase versionsDefault:
trueEnable X-ray auto-exploration featuresDefault:
trueSend anonymous usage statisticsDefault:
trueAllow persisting models to source databasesDefault:
falseEnable pivoted exports and subscriptionsDefault:
trueLicensing (Pro/Enterprise)
License token for Pro or Enterprise features
Get your token from the MetaStore
Advanced configuration
Maximum connection pool size for application databaseDefault: Calculated based on available connections
Thread pool size for sending notificationsDefault:
3Increase if alerts are slow to send.
Override base URL for notification links (Pro/Enterprise)Use case: Different URL for embedded vs. direct access
Using Docker secrets
For sensitive configuration, use Docker secrets instead of environment variables:docker-compose.yml
_FILE):
MB_DB_USER_FILEMB_DB_PASS_FILEMB_DB_CONNECTION_URI_FILEMB_EMAIL_SMTP_PASSWORD_FILEMB_EMAIL_SMTP_USERNAME_FILEMB_LDAP_PASSWORD_FILEMB_LDAP_BIND_DN_FILE
Environment file example
Create a.env file for easy configuration:
.env
Configuration precedence
When Metabase looks for configuration, the order of precedence is:- Environment variables (highest priority)
- Java system properties (
-Dflags) - Admin panel settings (stored in database)
- Default values (lowest priority)
Metabase Cloud
For Metabase Cloud instances, contact support to configure environment variables.Next steps
Configure database
Set up your application database
Running on Docker
Deploy with Docker and environment variables
Customizing Jetty
Advanced web server configuration
Email setup
Configure email notifications