SimpleNS LogoDocs

Configuration

Reference for bootstrap environment variables (.env) and live dynamic operational settings.


How Configuration Works in SimpleNS

SimpleNS splits configuration into two clear layers:

  1. Bootstrap Environment Variables (.env): Only the minimal connection, security, and server startup settings needed to boot the containers.
  2. 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

VariableDefaultDescription
PORT3000Port for the core API server.
MONGO_URIRequiredMongoDB connection string with replica set (e.g., mongodb://mongo:27017/simplens?replicaSet=rs0).
REDIS_URLRequiredRedis connection URL (e.g., redis://redis:6379).
BROKERSRequiredComma-separated Kafka broker list (e.g., kafka:9092).
BASE_PATH""Optional URL base path prefix when hosting behind a reverse proxy.
NODE_ENVdevelopmentSet to production in production deployments (enforces strict SSRF and security checks).

Security & Networking Variables

VariableDefaultDescription
JWT_SECRETRequiredSecret key for signing admin JWT/cookie sessions. Must be at least 32 characters.
CORS_ALLOWED_ORIGINSDefault-denyComma-separated list of allowed origins (e.g., http://localhost:3002). Requests from unlisted origins are blocked.
TRUST_PROXYfalseReverse 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_KEYAuto-generated32-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

VariableDefaultDescription
LOKI_URLhttp://localhost:3100Loki URL for centralized log aggregation.
LOG_LEVELinfoLog verbosity: debug, info, warn, error.
LOG_TO_FILEtrueWrite logs to local rotating log files.

Scaling & Worker Identity

VariableDefaultDescription
WORKER_IDAuto-generatedOptional unique identifier for a worker/processor instance.
PROCESSOR_CHANNELallProcess all channels (all) or dedicate a processor container to one channel (e.g., email).
DELAYED_PARTITION1Kafka partitions for delayed_notification.
NOTIFICATION_STATUS_PARTITION1Kafka 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

CategoryKey SettingsDefaults & Notes
Worker / OutboxPoll interval, batch size, claim timeout, retentionControls MongoDB transactional outbox publishing to Kafka.
Retry & IdempotencyMax retry count, processing TTL, idempotency TTLControls exponential backoff retries and request_id deduplication.
Delayed QueueDelayed poll interval, batch size, max poller retriesControls Redis scheduled/retry queue polling.
Recovery & CleanupRecovery poll interval, stuck thresholds, retention windowsIncludes cleanup_delivered_attachments_retention_ms (min 60000 ms, default 86400000 / 24h; 0 or null disables).
Attachmentsmax_file_size, max_file_countmax_file_size: 1 KB–500 MB (default 100 MB). max_file_count: 1–50 (default 10).
API & Rate LimitsBatch request limit, generalRateLimiter, authRateLimiterLive-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, YamlMigrator checks if your MongoDB plugin/provider/routing collections are empty.
  • If they are empty and a legacy simplens.config.yaml is present, YamlMigrator automatically imports your providers, credentials, and channel routings into MongoDB.
  • After migration, manage all plugins and providers from Dashboard → Plugins (/plugins).

On this page