Environment Variables

Fairvisor Edge is configured entirely through environment variables. The entrypoint.sh validates required variables at startup and fails fast if the configuration is invalid.

Core variables

VariableTypeRequiredDefaultDescription
FAIRVISOR_MODEstringNodecision_serviceOperating mode. decision_service or reverse_proxy.
FAIRVISOR_CONFIG_FILEstringConditionalPath to local policy bundle JSON. Required when FAIRVISOR_SAAS_URL is not set.
FAIRVISOR_SAAS_URLstringConditionalBase URL for SaaS config delivery (e.g., https://api.fairvisor.com).
FAIRVISOR_EDGE_IDstringConditionalEdge instance identifier. Required when FAIRVISOR_SAAS_URL is set.
FAIRVISOR_EDGE_TOKENstringConditionalBearer token for SaaS API authentication. Required when FAIRVISOR_SAAS_URL is set.
FAIRVISOR_BACKEND_URLstringConditionalhttp://127.0.0.1:8081Upstream backend URL. Required when FAIRVISOR_MODE=reverse_proxy.

Timing variables

VariableTypeDefaultDescription
FAIRVISOR_CONFIG_POLL_INTERVALinteger (seconds)30How often to poll SaaS for a new config bundle. Must be > 0.
FAIRVISOR_HEARTBEAT_INTERVALinteger (seconds)5How often to send a heartbeat to SaaS. Must be > 0.
FAIRVISOR_EVENT_FLUSH_INTERVALinteger (seconds)60How often to flush the event buffer to SaaS. Must be > 0.

Runtime tuning

VariableTypeDefaultDescription
FAIRVISOR_SHARED_DICT_SIZEstring128mSize of the Lua shared dict that holds all counter state. Accepts nginx size syntax: 128m, 256m, 1g.
FAIRVISOR_LOG_LEVELstringinfoNginx error_log level. Valid values: debug, info, notice, warn, error, crit, alert, emerg.
FAIRVISOR_WORKER_PROCESSESstringautoNginx worker_processes directive. Set to a number (e.g., 4) or auto.
FAIRVISOR_DEBUG_SESSION_SECRETstringEnables the per-session debug endpoints (POST /v1/debug/session, POST /v1/debug/logout). When set, requests carrying a valid signed debug cookie receive X-Fairvisor-Debug-* headers.

Validation rules

The startup script (entrypoint.sh) enforces these rules and exits non-zero if violated:

1. FAIRVISOR_MODE must be "decision_service" or "reverse_proxy"
2. If FAIRVISOR_MODE = "reverse_proxy":
     → FAIRVISOR_BACKEND_URL is required
3. If FAIRVISOR_SAAS_URL is set:
     → FAIRVISOR_EDGE_ID is required
     → FAIRVISOR_EDGE_TOKEN is required
4. Else (no SAAS_URL):
     → FAIRVISOR_CONFIG_FILE is required
5. *_INTERVAL values must be positive integers

Mode reference

Standalone

FAIRVISOR_MODE=decision_service
FAIRVISOR_CONFIG_FILE=/etc/fairvisor/policy.json

SaaS

FAIRVISOR_MODE=decision_service
FAIRVISOR_SAAS_URL=https://api.fairvisor.com
FAIRVISOR_EDGE_ID=edge-prod-us-east-1
FAIRVISOR_EDGE_TOKEN=fvt_live_xxxxxxxxxxxxx
FAIRVISOR_HEARTBEAT_INTERVAL=5
FAIRVISOR_CONFIG_POLL_INTERVAL=30
FAIRVISOR_EVENT_FLUSH_INTERVAL=60

Reverse proxy

FAIRVISOR_MODE=reverse_proxy
FAIRVISOR_CONFIG_FILE=/etc/fairvisor/policy.json
FAIRVISOR_BACKEND_URL=http://my-api-service:3000

Sensitive values

FAIRVISOR_EDGE_TOKEN is a bearer secret. Do not log or expose it:

  • In Docker: use a secrets mount or pass it at runtime (-e)
  • In Kubernetes: mount as a Secret volume or use envFrom
  • In CI/CD: store as a masked/protected variable, never in source code