Skip to main content

Environment Variables

Complete reference of environment variables used by LoyaltyOS services.

API Server​

Required​

VariableDescriptionExample
DATABASE_URLPostgreSQL connection stringpostgresql://user:pass@localhost:5432/db
REDIS_URLRedis connection stringredis://localhost:6379
JWT_SECRETSecret for JWT token signingopenssl rand -hex 64
API_KEY_SALTSalt for API key hashingopenssl rand -hex 32
KMS_MASTER_KEY32-byte hex key for credential encryptionopenssl rand -hex 32

Optional​

VariableDescriptionDefault
PORTAPI server port3002
NODE_ENVEnvironmentdevelopment
LOG_LEVELPino logger levelinfo
CORS_ORIGINAllowed CORS origin*
RATE_LIMIT_MAXMax requests per window100

Email (Resend)​

VariableDescriptionRequired
RESEND_API_KEYResend API keyProd
SMTP_HOSTSMTP server hostDev
SMTP_PORTSMTP server portDev
SMTP_FROMFrom addressDev

SMS (Twilio)​

VariableDescription
TWILIO_ACCOUNT_SIDTwilio account SID
TWILIO_AUTH_TOKENTwilio auth token
TWILIO_PHONE_NUMBERSender phone number
TWILIO_API_BASEAPI base URL (optional, for testing)

Push (OneSignal)​

VariableDescription
ONESIGNAL_APP_IDOneSignal app
ONESIGNAL_API_KEYOneSignal key
ONESIGNAL_API_BASEBase URL (optional)

Coalition — Apprecio​

VariableDescription
APPRECIO_API_BASEApprecio API base URL
APPRECIO_PUBLIC_TOKENPublic token (merchant)
APPRECIO_PRIVATE_TOKENPrivate token (signing)
APPRECIO_IDENTIFIER_TYPEemail or rut
APPRECIO_TIMEOUT_MSRequest timeout (ms)

Observability​

VariableDescriptionDefault
OTEL_EXPORTER_OTLP_ENDPOINTOTLP collector endpoint—
OTEL_SERVICE_NAMEService name in traces—
WORKER_METRICS_PORTPort for worker metrics endpoint3003

Docker Compose​

See infra/docker/.env.production.example for the full production template.