title: Navius Environment Variables Reference
description: Comprehensive reference of environment variables for configuring Navius applications
category: reference
tags:
configuration
environment-variables
settings
related:
../architecture/principles.md
../../guides/deployment/production-deployment.md
../../guides/deployment/cloud-deployment.md
last_updated: March 27, 2025
version: 1.0
This reference document provides a comprehensive list of all environment variables supported by the Navius framework. Environment variables are used to configure various aspects of the application without changing code or configuration files, making them ideal for deployment across different environments.
Variable Description Default Example
RUN_ENVApplication environment developmentproduction
PORTHTTP server port 30008080
HOSTHTTP server host 127.0.0.10.0.0.0
LOG_LEVELLogging verbosity level infodebug
LOG_FORMATLog output format textjson
CONFIG_PATHPath to configuration directory ./config/etc/navius/config
RUST_BACKTRACEEnable backtrace on errors 01
RUST_LOGDetailed logging configuration - navius=debug,warn
Variable Description Default Example
DATABASE_URLDatabase connection string - postgres://user:pass@localhost/dbname
DATABASE_POOL_SIZEMax database connections 520
DATABASE_TIMEOUT_SECONDSQuery timeout in seconds 3010
DATABASE_CONNECT_TIMEOUT_SECONDSConnection timeout in seconds 53
DATABASE_IDLE_TIMEOUT_SECONDSIdle connection timeout 300600
DATABASE_MAX_LIFETIME_SECONDSMax connection lifetime 18003600
DATABASE_SSL_MODESSL connection mode preferrequire
RUN_MIGRATIONSAuto-run migrations on startup falsetrue
Variable Description Default Example
REDIS_URLRedis connection URL - redis://localhost:6379
REDIS_POOL_SIZEMax Redis connections 510
REDIS_TIMEOUT_SECONDSRedis command timeout 53
CACHE_TTL_SECONDSDefault cache TTL 3600300
CACHE_PREFIXCache key prefix navius:myapp:prod:
CACHE_ENABLEDEnable caching truefalse
Variable Description Default Example
JWT_SECRETSecret for JWT tokens - your-jwt-secret-key
JWT_EXPIRATION_SECONDSJWT token expiration 864003600
CORS_ALLOWED_ORIGINSAllowed CORS origins *https://example.com,https://app.example.com
CORS_ALLOWED_METHODSAllowed CORS methods GET,POST,PUT,DELETEGET,POST
CORS_ALLOWED_HEADERSAllowed CORS headers Content-Type,AuthorizationX-API-Key,Authorization
CORS_MAX_AGE_SECONDSCORS preflight cache time 864003600
API_KEYGlobal API key for auth - your-api-key
TLS_CERT_PATHPath to TLS certificate - /etc/certs/server.crt
TLS_KEY_PATHPath to TLS private key - /etc/certs/server.key
ENABLE_TLSEnable TLS encryption falsetrue
Variable Description Default Example
REQUEST_TIMEOUT_SECONDSHTTP request timeout 3060
REQUEST_BODY_LIMITMax request body size 1MB10MB
ENABLE_COMPRESSIONEnable response compression truefalse
KEEP_ALIVE_SECONDSKeep-alive connection timeout 75120
MAX_CONNECTIONSMax concurrent connections 102410000
WORKERSNumber of worker threads (cores * 2) 8
ENABLE_HEALTH_CHECKEnable /health endpoint truefalse
GRACEFUL_SHUTDOWN_SECONDSGraceful shutdown period 3010
Variable Description Default Example
API_VERSIONDefault API version v1v2
ENABLE_DOCSEnable API documentation truefalse
DOCS_URL_PATHPath to API docs /docs/api/docs
RATE_LIMIT_ENABLEDEnable rate limiting falsetrue
RATE_LIMIT_REQUESTSMax requests per window 1001000
RATE_LIMIT_WINDOW_SECONDSRate limit time window 603600
API_BASE_PATHBase path for all APIs /api/api/v1
Variable Description Default Example
ENABLE_METRICSEnable Prometheus metrics truefalse
METRICS_PATHMetrics endpoint path /metrics/actuator/metrics
TRACING_ENABLEDEnable OpenTelemetry tracing falsetrue
JAEGER_ENDPOINTJaeger collector endpoint - http://jaeger:14268/api/traces
OTLP_ENDPOINTOTLP collector endpoint - http://collector:4317
SERVICE_NAMEService name for telemetry naviususer-service
LOG_REQUEST_HEADERSLog HTTP request headers falsetrue
HEALTH_CHECK_PATHHealth check endpoint path /health/actuator/health
Variable Description Default Example
EMAIL_SMTP_HOSTSMTP server host - smtp.example.com
EMAIL_SMTP_PORTSMTP server port 25587
EMAIL_SMTP_USERNAMESMTP authentication user - [email protected]
EMAIL_SMTP_PASSWORDSMTP authentication password - password
EMAIL_DEFAULT_FROMDefault sender address - [email protected]
AWS_ACCESS_KEY_IDAWS access key - AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEYAWS secret key - wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
AWS_REGIONAWS region us-east-1eu-west-1
S3_BUCKETS3 bucket name - my-app-uploads
S3_URL_EXPIRATION_SECONDSS3 presigned URL expiration 3600300
Variable Description Default Example
MEMORY_LIMITMemory limit in MB - 512
CPU_LIMITCPU limit (percentage) - 80
TOKIO_WORKER_THREADSTokio runtime worker threads (cores) 8
BLOCKING_THREADSTokio blocking thread pool size (cores * 4) 32
MAX_TASK_BACKLOGMax queued tasks 100005000
Variable Description Default Example
FEATURE_ADVANCED_SEARCHEnable advanced search falsetrue
FEATURE_FILE_UPLOADSEnable file uploads truefalse
FEATURE_WEBSOCKETSEnable WebSocket support falsetrue
FEATURE_BATCH_PROCESSINGEnable batch processing falsetrue
FEATURE_NOTIFICATIONSEnable notifications truefalse
Environment variables can be set in various ways:
# .env
DATABASE_URL=postgres://localhost/navius_dev
LOG_LEVEL=debug
FEATURE_ADVANCED_SEARCH=true
export DATABASE_URL=postgres://localhost/navius_dev
export LOG_LEVEL=debug
./run_dev.sh
docker run -e DATABASE_URL=postgres://db/navius -e LOG_LEVEL=info navius
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: db-credentials
key: url
- name: LOG_LEVEL
value: "info"
Environment variables are loaded in this order (later sources override earlier ones):
Default values
Configuration files (config/{environment}.toml)
.env file
Environment variables
Command line arguments