Skip to content

Configuration

Control Plane (moenet-core)

All configuration is via environment variables in .env.

Required Variables

VariableDescription
DB_PASSWORDPostgreSQL password
JWT_SECRETSecret for JWT token signing
TELEGRAM_BOT_TOKENBot token from @BotFather
TELEGRAM_ADMIN_USERNAMEAdmin Telegram username
TELEGRAM_ADMIN_CHAT_IDAdmin chat ID for notifications
WEBHOOK_DOMAINBot webhook domain
WEBHOOK_SECRETWebhook validation secret
AGENT_API_KEYShared key for agent authentication

Optional Variables

VariableDefaultDescription
HOST0.0.0.0API server bind address. Defaults to all interfaces (required so the bot/traefik containers can reach it); set to 127.0.0.1 to restrict.
DB_HOSTpostgresPostgreSQL host
DB_PORT5432PostgreSQL port
DB_NAMEmoenetDatabase name
DB_USERmoenetDatabase user
REDIS_HOSTredisRedis host
REDIS_PORT6379Redis port
REDIS_URLredis://moenet-redis:6379Redis connection URL
TRUSTED_PROXY_COUNT1Number of trusted reverse proxies in front of the API. Controls which X-Forwarded-For hop is used as the client IP for rate limiting and audit logs — set it to match your proxy chain or per-client limits will be wrong.
AGENT_AUTOUPDATEonSet to false to stop the Control Plane telling agents to auto-update. Use this when running custom/locally-built agent binaries (otherwise the stable auto-updater reverts them).
PEER_AUTO_APPROVEoffPeer-request approval policy. Default (false/unset) sends all non-admin requests to manual review. Set true for lenient auto-approve: all-green requests skip review, while hard blockers (unowned ULA/GUA IP, placeholder/reserved/CN endpoint) still escalate.
GRAFANA_PASSWORDGrafana admin password (used by the monitoring stack — set it, the compose no longer silently defaults to admin).
RATE_LIMIT_MAX20Bot requests per minute
RATE_LIMIT_WINDOW_MS60000Rate limit window

Rate limiting

The API exempts internal clients that present a valid AGENT_API_KEY (the bot and all agents) from rate limiting; limits apply to public traffic (login, the user /session API). See Monitoring.

Email Verification (Optional)

VariableDescription
MAILGUN_API_KEYMailgun API key
MAILGUN_DOMAINMailgun sending domain
MAILGUN_FROMSender email address

Agent (moenet-agent)

Agent configuration is via JSON config file. See Agent Config Reference for the full specification.

Config File Locations

The agent searches in order:

  1. Command line: ./moenet-agent -config /path/to/config.json
  2. Current directory: ./config.json
  3. System: /etc/moenet-agent/config.json
  4. User: ~/.config/moenet-agent/config.json

Environment Variable Overrides

VariableConfig PathDescription
MOENET_NODE_NAMEnode.nameNode name
MOENET_NODE_IDnode.idNode ID
MOENET_CP_URLcontrolPlane.urlControl Plane URL
MOENET_CP_TOKENcontrolPlane.tokenAgent token
MESH_ENABLEDSet to false to disable the agent's full-mesh iBGP-over-WireGuard (MeshSync). Default on; turn it off only when using a different inter-node interconnect.

Validate Config

bash
./moenet-agent -validate

MoeNet DN42 Network — AS4242420998