Skip to content

Environment Configuration

JSON Configuration Files

The framework loads configuration from JSON files. You can have different files for each environment:

config/
├── development.json
├── staging.json
└── production.json

Configuration Precedence

When multiple sources provide a value, the precedence is:

  1. Command-line flags — highest priority, override everything.
  2. JSON config file — loaded via --config or config.load_from_json().
  3. Code defaults — the configuration struct's default values (lowest priority).
bash
# CLI flags always win over JSON
./node --config config/production.json --port 9090  # port will be 9090, not what's in JSON

Configuration Overrides

Command-line arguments can override JSON config values:

bash
./node --config config/production.json --port 8080 --node-port 10001

Environment-Specific Settings

Development

json
{
  "ports": { "node_port": 10000, "client_port": 8080 },
  "logging": { "scopes": ["service", "operational", "verbose"] },
  "quotas": { "enabled": false },
  "wal": { "enabled": false }
}

Production

json
{
  "ports": { "node_port": 10000, "client_port": 8080 },
  "logging": { "scopes": ["service", "operational"] },
  "tls": {
    "cert_chain_file": "/etc/ssl/certs/server.crt",
    "private_key_file": "/etc/ssl/private/server.key"
  },
  "quotas": { "enabled": true },
  "wal": { "enabled": true }
}

Secrets Management

JWT keys and TLS certificates should never be hardcoded. Use environment variables or a secrets manager to inject them at runtime.