Skip to main content

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.

2 min readUpdated 2026-11-20Network engineer

Required#

VariableWhat breaks without it
PAYMENT_TOKEN_SECRETSessions, one-time codes, M-Pesa callback markers and paybill URL keys cannot be signed
CRON_SECRETEvery scheduled job answers 401: no suspensions, reminders, dispatch or retries
BACKEND_PUBLIC_URLSTK push refuses to start, and paybill URLs cannot be registered
SECRET_ENCRYPTION_KEYNo ISP can save credentials. Never change it once set
WHATSAPP_APP_SECRETEvery WhatsApp webhook is refused
WHATSAPP_VERIFY_TOKENMeta cannot verify the webhook URL
SYSTEM_ADMIN_EMAILSNo platform superadmin console

Optional#

VariableWhen to use it
ROUTER_RELAY_URL, ROUTER_RELAY_SECRET, ROUTER_RELAY_CERT_SHA256Routers on private addresses
MPESA_CALLBACK_ALLOWED_IPSA paybill whose C2B URLs Safaricom already holds from another system
MPESA_TRUSTED_IP_HEADERWhen behind another proxy that sets the real client IP
BILLING_SWEEP_ENFORCE=0To pause automatic suspension for the whole platform
NEXT_PUBLIC_BRAND_*Platform branding on the marketing site
SMTP_*Platform mailer

Notes#

  • Setting PAYMENT_TOKEN_SECRET for 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