Variable Naming
All configuration parameters can be set via environment variables using these rules:- Case insensitive - Use uppercase or lowercase
- Optional prefix - Can be prefixed with
SQLPAGE_ - Same name as JSON key - Variable name matches the configuration file key
SQLPAGE_ prefix is recommended to avoid conflicts with other applications.
Server Configuration
LISTEN_ON
Interface and port on which the web server should listen.
PORT
Port number to listen on. Overrides the port in
LISTEN_ON.UNIX_SOCKET
Path to a UNIX socket to listen on instead of TCP port. Mutually exclusive with
LISTEN_ON and PORT.HOST
The web address where your application is accessible. Used for OIDC redirects.
SITE_PREFIX
Base path of the site. Useful when hosting SQLPage behind a reverse proxy alongside other applications.
Database Configuration
DATABASE_URL
Database connection URL. Supports SQLite, PostgreSQL, MySQL, MSSQL, and ODBC connection strings.
DATABASE_PASSWORD
Database password. Overrides any password in
DATABASE_URL. Does not need percent-encoding.MAX_DATABASE_POOL_CONNECTIONS
Maximum number of simultaneous database connections.Defaults:
- PostgreSQL: 50
- MySQL: 75
- SQLite: 16
- MSSQL: 100
DATABASE_CONNECTION_IDLE_TIMEOUT_SECONDS
Close idle connections after this many seconds. Set to 0 to disable.Defaults:
- SQLite: No timeout
- Others: 1800 (30 minutes)
DATABASE_CONNECTION_MAX_LIFETIME_SECONDS
Close all connections after this many seconds. Set to 0 to disable.Defaults:
- SQLite: No limit
- Others: 3600 (60 minutes)
DATABASE_CONNECTION_ACQUIRE_TIMEOUT_SECONDS
Timeout when acquiring a connection from the pool.
DATABASE_CONNECTION_RETRIES
Connection attempts at startup before giving up. Retries happen every 5 seconds.
SQLITE_EXTENSIONS
Space-separated list of SQLite extensions to load.
Directory Configuration
WEB_ROOT
Root directory where
.sql files are located.CONFIGURATION_DIRECTORY
Directory containing
sqlpage.json, templates/, migrations/, etc.HTTPS Configuration
HTTPS_DOMAIN
Domain name for automatic HTTPS certificate via Let’s Encrypt.
HTTPS_CERTIFICATE_EMAIL
Email for Let’s Encrypt certificate notifications. Defaults to
contact@<https_domain>.HTTPS_CERTIFICATE_CACHE_DIR
Directory to cache HTTPS certificates.
HTTPS_ACME_DIRECTORY_URL
ACME directory URL for certificate requests.
OIDC Authentication
OIDC_ISSUER_URL
OpenID Connect provider base URL. Required for enabling Single Sign-On.
OIDC_CLIENT_ID
Client ID from your OIDC provider.
OIDC_CLIENT_SECRET
Client secret from your OIDC provider. Keep this confidential.
OIDC_SCOPES
Space-separated list of OAuth scopes to request.
OIDC_PROTECTED_PATHS
Space-separated list of URL prefixes that require authentication.
OIDC_PUBLIC_PATHS
Space-separated list of URL prefixes that are publicly accessible.
OIDC_ADDITIONAL_TRUSTED_AUDIENCES
Space-separated list of additional trusted JWT audiences beyond the client ID.
Security Configuration
ALLOW_EXEC
Allow
sqlpage.exec() function to execute shell commands.MAX_UPLOADED_FILE_SIZE
Maximum size of uploaded files in bytes (default: 5 MiB).
CONTENT_SECURITY_POLICY
Content Security Policy header value.
SYSTEM_ROOT_CA_CERTIFICATES
Use system root CA certificates for
sqlpage.fetch() SSL validation.MARKDOWN_ALLOW_DANGEROUS_HTML
Allow raw HTML in markdown content.
MARKDOWN_ALLOW_DANGEROUS_PROTOCOL
Allow dangerous protocols like
javascript: in markdown links.Performance Configuration
ENVIRONMENT
Runtime environment:
development or production.In production:- Errors are hidden from users
- SQL files are cached in memory
- Cache stale duration defaults to 1 second
CACHE_STALE_DURATION_MS
Milliseconds before checking if a cached file is fresh. Defaults to 1000ms in production, 0ms in development.
MAX_PENDING_ROWS
Maximum rendered rows queued in memory for slow clients.
COMPRESS_RESPONSES
Compress HTTP response bodies when supported by the client.
MAX_RECURSION_DEPTH
Maximum recursion depth for
run_sql() function.Debugging
RUST_LOG
Control logging verbosity. Not a SQLPage-specific variable, but very useful for debugging.
SSL_CERT_FILE
Path to SSL certificate file for
sqlpage.fetch() to use.SSL_CERT_DIR
Directory containing SSL certificates for
sqlpage.fetch() to use.Example .env Files
Basic Setup
Production with PostgreSQL
With OIDC Authentication
Docker Deployment
Tips
Use .env files for local development
Use .env files for local development
Create a
.env file in your project root and add it to .gitignore. SQLPage automatically loads it.Use SQLPAGE_ prefix in shared environments
Use SQLPAGE_ prefix in shared environments
Override configuration file with environment variables
Override configuration file with environment variables
Environment variables take precedence over configuration files, making it easy to override settings in different environments:
Use DATABASE_PASSWORD for secrets
Use DATABASE_PASSWORD for secrets
Keep passwords separate from connection strings:
Enable debug logging when troubleshooting
Enable debug logging when troubleshooting
See exactly what SQLPage is doing:
Related Topics
Configuration Overview
Learn about all configuration methods
Database Connections
Configure database connections
HTTPS & SSL
Set up automatic HTTPS
Deployment
Deploy SQLPage to production