Self-host environment variables (operators only)
For operators who run Metron themselves: the required secrets, optional switches, and what breaks without each. Tenants on the shared service do not set any of these.
Required#
| Variable | What breaks without it |
|---|---|
PAYMENT_TOKEN_SECRET | Sessions, one-time codes, M-Pesa callback markers and paybill URL keys cannot be signed |
CRON_SECRET | Every scheduled job answers 401: no suspensions, reminders, dispatch or retries |
BACKEND_PUBLIC_URL | STK push refuses to start, and paybill URLs cannot be registered |
SECRET_ENCRYPTION_KEY | No ISP can save credentials. Never change it once set |
WHATSAPP_APP_SECRET | Every WhatsApp webhook is refused |
WHATSAPP_VERIFY_TOKEN | Meta cannot verify the webhook URL |
SYSTEM_ADMIN_EMAILS | No platform superadmin console |
Optional#
| Variable | When to use it |
|---|---|
ROUTER_RELAY_URL, ROUTER_RELAY_SECRET, ROUTER_RELAY_CERT_SHA256 | Routers on private addresses |
MPESA_CALLBACK_ALLOWED_IPS | A paybill whose C2B URLs Safaricom already holds from another system |
MPESA_TRUSTED_IP_HEADER | When behind another proxy that sets the real client IP |
BILLING_SWEEP_ENFORCE=0 | To pause automatic suspension for the whole platform |
NEXT_PUBLIC_BRAND_* | Platform branding on the marketing site |
SMTP_* | Platform mailer |
Notes#
- Setting
PAYMENT_TOKEN_SECRETfor the first time signs everyone out once. - If you rotate it, keep the old value in
PAYMENT_TOKEN_SECRET_PREVIOUS, because Safaricom keeps the URLs it was first given. - Redeploy after changing variables.
- Install the scheduler once per database. It creates the jobs listed in Automations and schedules.
Verify#
Request the billing sweep without a header: it should answer 401. With the correct bearer secret and a dry-run flag it should answer 200.
Router relay#
The relay runs on the server where your tunnels end. It needs its own certificate and a shared secret, should be restricted to your tunnel network, and exposes TCP 8443. The fingerprint it prints at start goes in ROUTER_RELAY_CERT_SHA256.
Something missing or wrong in this guide?WhatsApp usEmail feedback