Configuration
Reference for bootstrap environment variables (.env) and live dynamic operational settings.
How Configuration Works in SimpleNS
SimpleNS splits configuration into two clear layers:
- Bootstrap Environment Variables (
.env): Only the minimal connection, security, and server startup settings needed to boot the containers. - Dynamic Operational Settings (MongoDB + Dashboard
/settings): Worker intervals, retry counts, rate limits, attachment limits, and cleanup retention windows. These are stored in MongoDB and hot-reloaded across all services via Redis Pub/Sub (DynamicConfigService) with zero restarts.
Where did plugin YAML and env-var admin passwords go?
Plugins, provider credentials, channel routing, and admin credentials now live in MongoDB and are managed through the Admin Dashboard (/setup, /plugins, /keys, /settings).
Bootstrap Environment Variables (.env)
Copy .env.example to .env (or let npx @simplens/onboard generate it).
Core Connection & Server Variables
| Variable | Default | Description |
|---|---|---|
PORT | 3000 | Port for the core API server. |
MONGO_URI | Required | MongoDB connection string with replica set (e.g., mongodb://mongo:27017/simplens?replicaSet=rs0). |
REDIS_URL | Required | Redis connection URL (e.g., redis://redis:6379). |
BROKERS | Required | Comma-separated Kafka broker list (e.g., kafka:9092). |
BASE_PATH | "" | Optional URL base path prefix when hosting behind a reverse proxy. |
NODE_ENV | development | Set to production in production deployments (enforces strict SSRF and security checks). |
Security & Networking Variables
| Variable | Default | Description |
|---|---|---|
JWT_SECRET | Required | Secret key for signing admin JWT/cookie sessions. Must be at least 32 characters. |
CORS_ALLOWED_ORIGINS | Default-deny | Comma-separated list of allowed origins (e.g., http://localhost:3002). Requests from unlisted origins are blocked. |
TRUST_PROXY | false | Reverse proxy trust setting for Express IP resolution (e.g., 1 for 1 proxy hop, or a CIDR/IP). Rejects true to prevent IP spoofing. |
ADMIN_ALERT_ENCRYPTION_KEY | Auto-generated | 32-byte key used to encrypt provider, storage, and admin alert credentials in MongoDB. Set explicitly in production. |
TRUST_PROXY & Rate Limiting
Never set TRUST_PROXY=true. SimpleNS rejects true at startup because permissive proxy trust lets clients spoof X-Forwarded-For headers and bypass IP rate limiting. Use a hop count (1) or explicit IP/subnet instead.
Logging Variables
| Variable | Default | Description |
|---|---|---|
LOKI_URL | http://localhost:3100 | Loki URL for centralized log aggregation. |
LOG_LEVEL | info | Log verbosity: debug, info, warn, error. |
LOG_TO_FILE | true | Write logs to local rotating log files. |
Scaling & Worker Identity
| Variable | Default | Description |
|---|---|---|
WORKER_ID | Auto-generated | Optional unique identifier for a worker/processor instance. |
PROCESSOR_CHANNEL | all | Process all channels (all) or dedicate a processor container to one channel (e.g., email). |
DELAYED_PARTITION | 1 | Kafka partitions for delayed_notification. |
NOTIFICATION_STATUS_PARTITION | 1 | Kafka partitions for notification_status. |
Per-Channel Kafka Partitions
Channel-specific Kafka partitions (e.g., email_notification, sms_notification) are not set in .env. They are configured dynamically in Dashboard → Channel Routing when configuring a channel (default: 6 partitions).
Dynamic Operational Settings (Dashboard /settings)
All runtime operational parameters are edited live in Dashboard → Settings (/settings) (or via /api/settings). Changes take effect immediately across API servers, workers, and processors.
Categories & Key Parameters
| Category | Key Settings | Defaults & Notes |
|---|---|---|
| Worker / Outbox | Poll interval, batch size, claim timeout, retention | Controls MongoDB transactional outbox publishing to Kafka. |
| Retry & Idempotency | Max retry count, processing TTL, idempotency TTL | Controls exponential backoff retries and request_id deduplication. |
| Delayed Queue | Delayed poll interval, batch size, max poller retries | Controls Redis scheduled/retry queue polling. |
| Recovery & Cleanup | Recovery poll interval, stuck thresholds, retention windows | Includes cleanup_delivered_attachments_retention_ms (min 60000 ms, default 86400000 / 24h; 0 or null disables). |
| Attachments | max_file_size, max_file_count | max_file_size: 1 KB–500 MB (default 100 MB). max_file_count: 1–50 (default 10). |
| API & Rate Limits | Batch request limit, generalRateLimiter, authRateLimiter | Live-tunable Redis-backed IP rate limits for general API traffic and strict auth endpoints. |
Legacy YAML Migration (YamlMigrator)
If you are upgrading from an older version of SimpleNS that used simplens.config.yaml and @simplens/config-gen:
- On startup,
YamlMigratorchecks if your MongoDB plugin/provider/routing collections are empty. - If they are empty and a legacy
simplens.config.yamlis present,YamlMigratorautomatically imports your providers, credentials, and channel routings into MongoDB. - After migration, manage all plugins and providers from Dashboard → Plugins (
/plugins).
Docs