Environment Variables
Complete reference for all CloudNexus platform environment variables. Use these to configure deployments, manage secrets, control scaling behavior, and integrate with external services.
💡 Tip: Variables prefixed with
CN_ are reserved for CloudNexus platform configuration. Do not override them unless explicitly documented. Custom variables should use your application's namespace.
⚙️ Core Platform
| Variable | Type | Default | Description |
|---|---|---|---|
| CN_REGIONRequired | String | us-east-1 | Primary deployment region. Supported values: us-east-1, eu-west-1, ap-south-1, sa-east-1. |
| CN_ENVOptional | String | production | Application environment stage. Affects logging verbosity, cache TTL, and deployment routing. |
| CN_REPLICASOptional | Integer | 2 | Minimum number of running instances. Auto-scaling will never scale below this value. |
| CN_HEALTH_CHECK_PATHOptional | String | /health | HTTP endpoint used by the load balancer to verify instance readiness. Must return HTTP 200. |
🗄️ Database & Storage
| Variable | Type | Default | Description |
|---|---|---|---|
| CN_DB_HOSTRequired | String | null | Hostname of the managed PostgreSQL/MySQL instance. Auto-injected when using CloudNexus Managed Databases. |
| CN_DB_PORTOptional | Integer | 5432 | Database connection port. Use 6379 for Redis, 27017 for MongoDB. |
| CN_DB_POOL_SIZEOptional | Integer | 20 | Maximum concurrent connections per instance. Should not exceed 80% of your database plan's connection limit. |
🌐 CDN & Network
| Variable | Type | Default | Description |
|---|---|---|---|
| CN_CDN_TTLOptional | Integer | 3600 | Cache time-to-live in seconds for static assets at edge locations. Set to 0 to disable caching. |
| CN_PROTOCOLOptional | String | https | Enforce traffic protocol. Values: http, https, auto (recommended). |
🔒 Security & Compliance
| Variable | Type | Default | Description |
|---|---|---|---|
| CN_SSL_MODEOptional | String | force | SSL/TLS termination behavior. force redirects HTTP→HTTPS, permissive allows both, disable (not recommended). |
| CN_WAF_RULESOptional | String | standard | Web Application Firewall preset. Options: strict, standard, paranoid, or custom rule ID. |
💳 Billing & Usage
| Variable | Type | Default | Description |
|---|---|---|---|
| CN_BILLING_ALERTOptional | Float | 100.0 | Monthly spend threshold in USD. Triggers email/webhook alerts when projected usage exceeds this amount. |
| CN_METRICS_RETENTIONOptional | String | 30d | How long to retain detailed usage metrics. Formats: 7d, 30d, 90d, 1y. |
Usage Examples
.env / Deployment Config
# Core Configuration
CN_REGION=eu-west-1
CN_ENV=staging
CN_REPLICAS=3
# Database Pooling
CN_DB_POOL_SIZE=40
CN_DB_HOST=db-prod-82a.cloudnexus.net
# CDN & Security
CN_CDN_TTL=7200
CN_SSL_MODE=force
CN_WAF_RULES=strict
cloudnexus deploy (CLI)
# Override variables inline during deployment
cloudnexus deploy \
--env CN_REGION=ap-south-1 \
--env CN_REPLICAS=5 \
--env CN_WAF_RULES=paranoid
# Load from .env file
cloudnexus deploy --env-file .env.production
⚠️ Important: Changes to environment variables require a deployment restart to take effect. Use the CLI or dashboard
cn restart --graceful to avoid service interruption. Sensitive values (passwords, API keys) should be stored using CloudNexus Secrets Manager, not plain environment variables.