Skip to content

Environment variables ​

Catalog of variables the platform reads. Sources: root .env.example (app host) and observability/.env.example (monitoring host), plus a few runtime-only keys the API schema accepts. Do not put live secrets in git, tickets, or this site.

Local first-run still starts with cp .env.example .env — see Run locally. Production files are described in Production.

Format ​

ConventionRule
File syntaxKEY=value per line. Production installer writes KEY="value" via upsert_env.
EmptyEmpty means unset for most optional keys. Do not use the string undefined.
BooleansLiteral true / false (strings). Unset is usually false.
ListsComma-separated, no spaces unless the value itself contains spaces (CIDRs, origins, image remote hosts).
URLsMust parse as a URL. Production often requires https:. No trailing path unless the name says otherwise (FUNDIST_OW_CALLBACK_PATH is a path).
IntegersDecimal milliseconds, seconds, minutes, or ports as documented per key.
Secrets (≥32)Production rejects placeholders containing changeme, change-me, replace-me, your-, or password, and requires length ≥ 32 for owned secrets (auth, P2P, payment encryption).
NEXT_PUBLIC_*Inlined when Next.js images are baked. Runtime .env changes do not update the player/admin/support bundle until you rebuild the image.

Comments in .env.example start with #. Docker Compose interpolates /opt/swaggbet/current/.env on the app host. Durable secrets belong in /opt/swaggbet/shared/main.env and must be copied onto current/.env before recreate — Compose does not read shared/main.env by itself.

ACTIVE_OPTIONAL_INTEGRATIONS is always injected in production compose. Locally, leave it empty to auto-enable from credentials; set it explicitly in deployed env (customerio, analytics,customerio, …) so API enqueue and workers stay aligned. An empty value in production used to silently disable CRM.

App host — core runtime ​

VariableFormat / valuesNotes
NODE_ENVdevelopment | production | testAPI default development.
PORTinteger, default 3000 locallyWeb. API defaults to 8787 in process (not this key in Docker).
HOST / BIND_ADDRESShostname or IPOptional API bind.
UPSTREAM_TIMEOUT_MSinteger ms, default 12000Nginx/upstream budget used by setup.
NEXT_DEPLOYMENT_IDopaque stringEmpty locally; production scripts write a unique value for Next.js version-skew protection.
NEXT_TELEMETRY_DISABLED1Disables Next.js telemetry.

Database, Postgres, backups ​

VariableFormat / valuesNotes
DATABASE_URLpostgresql://user:pass@host:5432/dbMain casino DB. Required.
P2P_DATABASE_URLsameIsolated P2P schema/database.
POSTGRES_PASSWORDsecretSuperuser for the Postgres container.
MIGRATION_DATABASE_PASSWORDsecretDDL role for db-migrate.
API_DATABASE_PASSWORDsecretDML role for API/workers.
P2P_DATABASE_PASSWORDsecretP2P runtime.
P2P_MIGRATION_PASSWORDsecretP2P DDL.
MONITORING_DATABASE_PASSWORDsecretswaggbet_monitor / postgres-exporter. Required in compose.
PGBOUNCER_MAX_CLIENT_CONNinteger, default 1200
PGBOUNCER_DEFAULT_POOL_SIZEinteger, default 30
PGBOUNCER_RESERVE_POOL_SIZEinteger, default 5
DB_POOL_MAX / DB_POOL_IDLE_TIMEOUTinteger stringsOptional API pool overrides.
PGBACKREST_ENABLEDtrue | falseProduction expects off-host WAL.
PGBACKREST_S3_BUCKET / _ENDPOINT / _REGION / _KEY / _KEY_SECRETS3-styleEmpty disables remote rest.
PGBACKREST_S3_URI_STYLEhost (default) or path
PGBACKREST_CIPHER_PASSsecretRepo cipher.
SWAGGBET_DB_BACKUP_DIRabsolute pathOn-host dumps, default /var/lib/swaggbet/db-backups.
SWAGGBET_DB_BACKUP_RETENTION_DAYSinteger, default 7
RESTIC_REPOSITORY / RESTIC_PASSWORDrestic URL + secretAsset backups.
ASSET_BACKUP_S3_KEY / _KEY_SECRET / _REGIONS3Region default us-east-1.
POSTGRES_REPLICATION_ROLEidentifier, default swaggbet_replicator
POSTGRES_REPLICATION_SLOTidentifier, default analytics_test
POSTGRES_REPLICATION_CLIENT_CIDRSCIDR listEmpty keeps 5432 unpublished.
REPLICATION_DATABASE_PASSWORDsecretDo not reuse the app superuser.
POSTGRES_REPLICATION_PRIMARY_HOSTIP/hostTEST analytics host only.
POSTGRES_ANALYTICS_PORTinteger, e.g. 5433TEST analytics host only.

Redis and realtime ​

VariableFormat / valuesNotes
REDIS_URLredis://host:6379 or with passwordRequired for WebSocket tickets and fan-out.
REDIS_PASSWORDsecretRequired in production compose (no insecure default).
REALTIME_WORKER_IDstringOptional stable worker id.
REALTIME_BATCH_SIZEinteger, default 50
REALTIME_POLL_INTERVAL_MSinteger, default 500
REALTIME_LOCK_TTL_MSinteger, default 300000
REALTIME_PROCESSED_RETENTION_MSinteger, default 86400000
REALTIME_PUBLISH_CONCURRENCYinteger, default 10
REALTIME_PUBLISH_TIMEOUT_MSinteger, default 10000
REALTIME_MAX_READY_LAG_MSinteger, default 60000Readiness lag budget.
REALTIME_PORTinteger, default 8792

Authentication, cookies, CORS ​

VariableFormat / valuesNotes
AUTH_SECRET≥32 char secretAuth.js session encryption. Keep stable across replicas.
AUTH_SECRET_PREVIOUSsecretOptional 30-day rotation window.
AUTH_ACCESS_TOKEN_SECRET≥32 char secretAPI access tokens; independent of AUTH_SECRET.
AUTH_ACCESS_TOKEN_SECRET_PREVIOUSsecretRotation.
AUTH_ACCESS_TOKEN_KIDstring, default primaryKey id in tokens.
AUTH_AUDIENCEstring, default swaggbet-apiToken aud.
AUTH_ISSUERURLToken iss; local http://localhost:3000.
NEXTAUTH_URLURLPlayer Auth.js canonical URL.
ADMIN_NEXTAUTH_URLURLAdmin.
SUPPORT_NEXTAUTH_URLURLSupport.
AUTH_COOKIE_DOMAINhostname or emptyShared cookie domain when set.
AUTH_INSECURE_COOKIEStrue | emptyLocal HTTP only.
AUTH_ALLOW_MFA_SKIPtrue | false | emptyRejected in production. Local MFA escape hatch.
TOTP_ENCRYPTION_KEY / _PREVIOUSsecret2FA secret at rest.
EMAIL_VERIFICATION_SECRET / PASSWORD_RESET_SECRETsecretOptional; fall back to AUTH_SECRET.
ADMIN_SUPPORT_ALLOWED_CIDRSCIDR listRequired for production admin/support ingress.
ADMIN_SUPPORT_NETWORK_RESTRICTION_DISABLEDtrue | falseBreak-glass; default false.
TRUSTED_PROXY_CIDRSCIDR listImmediate nginx/container hop only.
CORS_ALLOW_IPIP or emptyExtra CORS IP.
CORS_ALLOWED_ORIGINScomma-separated full originsBeyond first-party hosts.
ADMIN_EMAIL / ADMIN_PASSWORDemail + passwordBootstrap only; never leave changeme in prod.

Public site, locales, promo ​

VariableFormat / valuesNotes
NEXT_PUBLIC_WEB_URLURLPlayer origin.
NEXT_PUBLIC_API_URLURLBrowser → API. Bake-time.
NEXT_PUBLIC_SITE_NAME / _SHORT_NAME / _DESCRIPTIONstringBrand copy in the bundle. Unset short name defaults in code (not necessarily “OmadX”).
NEXT_PUBLIC_SUPPORT_EMAILemail
NEXT_PUBLIC_LICENSE_ENTITY / _NUMBER / _REGULATORstringFooter license line.
NEXT_PUBLIC_OPERATOR_LEGAL_NAME / _ADDRESS / _REGISTRATIONstringOptional operator identity override (footer defaults to Zenorix / C62637 in code).
NEXT_PUBLIC_IMAGE_REMOTE_HOSTShostname listExtra /_next/image hosts. Never * / **.
DEFAULT_LANGUAGEuz | en | es | ruDefault uz.
DEFAULT_AFFILIATE_TAGstring
POST_REGISTER_PATHpath, default /
PLATFORM_ORIGINURLServer-side player origin.
PLAYER_WEB_URLURLPublic player origin (admin slot images, Fundist launch).
INTERNAL_API_ORIGINURLPromo → API on Docker network.
INTERNAL_WEB_URLURLOptional API→web.
PROMO_TERMS_PATH / PROMO_PRIVACY_PATHpathPromo legal links.
WEBHOOK_BASE_URLorigin, no pathPublic API origin for provider callbacks.

OAuth, Telegram, pixels ​

Empty client ids disable that provider.

VariableFormat / valuesNotes
GOOGLE_CLIENT_ID / _SECRETOAuth
FACEBOOK_CLIENT_ID / _SECRETOAuth
FACEBOOK_CAPI_ACCESS_TOKEN / _TEST_EVENT_CODEsecret / stringConversion API.
NEXT_PUBLIC_FACEBOOK_PIXEL_IDpixel idBake-time.
DISCORD_CLIENT_ID / _SECRETOAuth
APPLE_CLIENT_ID / _SECRETOAuth
TELEGRAM_BOT_TOKENbot tokenLogin widget / bot.
TELEGRAM_BOT_USERNAMEusername without @
NEXT_PUBLIC_TELEGRAM_BOT_USERNAMEsameBake-time.

Wallet, KYC, uploads ​

VariableFormat / valuesNotes
WALLET_ENCRYPTION_KEY≥32 char secretWallet material at rest.
KYC_DOCUMENTS_DIRpathRelative from repo root locally; production compose uses /app/uploads/kyc.
NOTIFICATION_MEDIA_DIRpath, default ./uploads/notifications
NOTIFICATION_MEDIA_PUBLIC_BASE_URLURL or emptyAdmin draft URLs only.

Game aggregators ​

VariableFormat / valuesNotes
GAME_PROVIDERalternative | fundistDefault alternative (Platform API).
NEXT_PUBLIC_GAME_PROVIDERsameMust stay aligned; bake-time Live Casino gating.
GAME_SYNC_SECRETsecretPOST /game/catalog/sync.
REVALIDATE_SECRETsecretPOST /api/revalidate/config (no fallback).

Alternative (Platform API / CasinoMobule) ​

Required when GAME_PROVIDER=alternative.

VariableFormat / valuesNotes
ALTERNATIVE_API_URLURLe.g. https://test.partners.casinomobule.com
ALTERNATIVE_PARTNER_ALIASstring
ALTERNATIVE_SECRET_KEYsecret
ALLOW_UNSIGNED_ALTERNATIVE_CALLBACKStrue | falseDefault false. Never true in production.

Fundist ​

Required when GAME_PROVIDER=fundist.

VariableFormat / valuesNotes
FUNDIST_API_URLURLTest https://apitest.fundist.org/. Prod https://apiprod5.fundist.org/ (legacy https://api.fundist.org/ still accepted by some accounts).
FUNDIST_API_KEY / FUNDIST_API_PWDsecret
FUNDIST_CASINO_SERVER_IPIPv4Public IP Fundist must whitelist. Default 0.0.0.0.
FUNDIST_OW_SECRETsecretOneWallet HMAC; same value in Fundist backoffice.
FUNDIST_OW_CALLBACK_PATHpath, default /fundist/onewalletPublic callback is https://api.{domain} + this path.
FUNDIST_OW_PEER_URLURLOptional: forward “Invalid userid” callbacks to a peer (staging/prod sharing one merchant).
FUNDIST_ALLOWED_IPSIP list or ** local-only. Production: Fundist egress IPs.
FUNDIST_LAUNCH_BASE_URLURLDefaults to WEBHOOK_BASE_URL.
FUNDIST_USERAUTH_REF_ORIGINURLOptional ref= override when PLAYER_WEB_URL is not yet allowlisted.
FUNDIST_DEFAULT_COUNTRYISO 3166-1 alpha-2 (XX)Optional.

Payments ​

VariableFormat / valuesNotes
PAYMENT_PROVIDER_CREDENTIAL_ENCRYPTION_KEY≥32 char secretEncrypts admin-managed provider rows. Same value on API and admin.
PAYMENT_PROVIDER_CREDENTIAL_ENCRYPTION_KEY_PREVIOUSsecretRotation; remove after re-save.
CRYPTOCLOUD_API_KEY / _SECRET_KEY / _SHOP_IDsecretsEnv is a temporary fallback; prefer DB rows.
CRYPTOCLOUD_WEBHOOK_URLHTTPS URLPublic postback.
PAYOU_MERCHANT_ID / PAYOU_SECRET_KEYsecretsFiat.
PAYOU_ENDPOINTURL, default https://payou.pro/api/new/api.php

Alanbase S2S (HTTPS required in production):

VariableFormat / valuesNotes
ALANBASE_EVENTS_URLHTTPS URLhttps://{brand}.postback.alanbase.com/events/{client_key}
ALANBASE_GOALS_URLHTTPS URL or emptyDerived from events URL if empty (/events/ → /goals/).
ALANBASE_TIMEOUT_MSinteger ms, default 5000

P2P / Mercado Pago ​

Configure URL and secret together. Production requires HTTPS and strong secrets.

VariableFormat / valuesNotes
P2P_PUBLIC_URLURLPlayer-facing P2P origin.
P2P_ADMIN_USERNAME / P2P_ADMIN_PASSWORDstringP2P admin basic auth.
P2P_UPLOAD_DIRpathLocal default ./apps/p2p/uploads.
P2P_INTERNAL_API_SECRETsecretCasino → P2P.
P2P_PROVIDER_API_URL / P2P_PROVIDER_API_SECRETHTTPS URL + ≥32 secret
P2P_PAYMENT_TTL_MINUTESpositive number, default 60
P2P_CASINO_WEBHOOK_URLURLe.g. http://localhost:8787/webhook/p2p
P2P_CASINO_WEBHOOK_SECRET / P2P_WEBHOOK_SECRET≥32 secret when P2P enabled
P2P_CASINO_RETURN_URLURL
P2P_CREDENTIAL_ENCRYPTION_KEY / _PREVIOUSsecretMP credentials at rest.
P2P_MP_HEALTH_MAX_AGE_MINUTESinteger, default 30
P2P_MP_RECONCILE_FAST_INTERVAL_SECONDSinteger, default 10
P2P_MP_RECONCILE_SLOW_INTERVAL_SECONDSinteger, default 30
P2P_MP_RECONCILE_FAST_WINDOW_MINUTESinteger, default 2
P2P_MP_RECONCILE_BATCH_SIZEinteger, default 50
P2P_MP_RECONCILE_CONCURRENCYinteger, default 5
MERCADOPAGO_API_BASEURL, default https://api.mercadopago.com

Email, CRM, analytics, push ​

VariableFormat / valuesNotes
EMAIL_PROVIDERresend | mailersend | unioneDefault resend. In-process in apps/api.
RESEND_API_KEY / MAILERSEND_API_KEY / UNIONE_API_KEYsecretRequired for the selected provider.
UNIONE_API_URLURLDefault UniOne transactional v1 base.
FROM_EMAILemailMust be a verified domain on the ESP.
SUPPORT_INBOXemailContact-us delivery override.
TRANSACTIONAL_EMAIL_VIA_CUSTOMERIOtrue | unsetSkip ESP when CIO App API is not ready.
ACTIVE_OPTIONAL_INTEGRATIONScomma list: customerio, analytics, …See format section.
CUSTOMERIO_SITE_ID / CUSTOMERIO_TRACK_API_KEYid + secretClassic Track; both required to enable the worker. Site id is also injected into web for In-App. Never expose the track key to the browser.
CUSTOMERIO_APP_API_KEYsecretBearer for App API (/v1/send/email and GET /v1/transactional/{id}/contents).
CUSTOMERIO_TRANSACTIONAL_APP_APItrue | 1 | yes | unsetLeave unset in production until Customer.io verifies the From domain. Unset = fetch CIO HTML and send through UniOne.
CUSTOMERIO_TRANSACTIONAL_FROMName <email> or emptyOptional App API From override. Empty uses the template sender.
CUSTOMERIO_TRANSACTIONAL_PASSWORD_RESET_ID / _EMAIL_VERIFICATION_IDmessage id or trigger namePassword-reset default 8. Email-confirm is optional (not in the player catalog).
CUSTOMERIO_TRANSACTIONAL_REGISTRATION_ID / _DEPOSIT_CREDITED_ID / _DEPOSIT_FAILED_ID / _WITHDRAWAL_REQUESTED_ID / _WITHDRAWAL_COMPLETED_ID / _WITHDRAWAL_REJECTED_ID / _BONUS_CREDITED_ID / _BONUS_WAGERED_ID / _ACCOUNT_RESTRICTED_IDnumeric id or triggerDefaults 6 / 10 / 13 / 17 / 19 / 21 / 24 / 27 / 30. Override only if CIO ids change.
CUSTOMERIO_REGIONus | eu (typical)Default us.
CUSTOMERIO_PORTinteger, default 8791
CUSTOMERIO_WORKER_IDstring
CUSTOMERIO_BATCH_SIZEinteger, default 50
CUSTOMERIO_CONCURRENCYinteger, default 10Per-user order preserved.
CUSTOMERIO_POLL_INTERVAL_MSinteger, default 2000
CUSTOMERIO_LOCK_TTL_MSinteger, default 300000
CUSTOMERIO_TIMEOUT_MSinteger, default 10000
CUSTOMERIO_RATE_LIMIT_PAUSE_MSinteger, default 5000
CLICKHOUSE_URL / CLICKHOUSE_PASSWORDURL + secretBoth required to enable analytics worker.
CLICKHOUSE_USERNAMEstring, default default
CLICKHOUSE_DATABASEstring, default default
CLICKHOUSE_BATCH_SIZEinteger, default 1000
CLICKHOUSE_FLUSH_INTERVAL_MS / _POLL_INTERVAL_MSinteger, default 1000
CLICKHOUSE_LOCK_TTL_MSinteger, default 300000
STREAMER_WORKER_IDstring
STREAMER_PORTinteger, default 8789
NOTIFIER_PORTinteger, default 8790
NOTIFIER_WORKER_IDstring
NOTIFIER_BATCH_SIZEinteger, default 100
NOTIFIER_POLL_INTERVAL_MSinteger, default 5000
ONESIGNAL_APP_ID / NEXT_PUBLIC_ONESIGNAL_APP_IDUUIDPWA web push. Prefer ONESIGNAL_APP_ID in compose so bake picks it up.

GeoIP ​

VariableFormat / valuesNotes
GEOIP_DATA_DIRECTORYpathGeoLite2 Country MMDB dir.
GEOIP_MMDB_PATHpathExplicit file; skips auto update.
GEOIP_AUTO_UPDATE0 to disableOtherwise start refreshes from the redistributable mirror.

App-host observability ​

VariableFormat / valuesNotes
OTEL_ENABLEDtrue | falseProduction setup sets true (--otel-disabled to leave false).
OTEL_SERVICE_NAMEstringLeave empty in .env; each container overrides (swaggbet-api, …).
OTEL_EXPORTER_OTLP_ENDPOINTURLLocal http://localhost:4318; Docker http://alloy:4318.
OBSERVABILITY_ENVIRONMENTdevelopment | production | …
NEXT_PUBLIC_OBSERVABILITY_ENVIRONMENTsameBake-time.
OBSERVABILITY_RELEASE / NEXT_PUBLIC_OBSERVABILITY_RELEASEstringlocal until build.sh / setup writes a UTC timestamp.
OBSERVABILITY_CLUSTERomadx | test | …Grafana series label. Derived from domain on setup.
OBSERVABILITY_LOG_LEVELinfo | debug | …Default info.
OBSERVABILITY_OTLP_METRICS_ENABLEDtrue | falseKeep false; HTTP RED comes from /metrics.
OBSERVABILITY_METRICS_ENABLEDtrue | falseLegacy alias of OTLP metrics. Do not enable both paths.
OBSERVABILITY_TRACES_ENABLEDtrue | falseDefault true.
OBSERVABILITY_TRACE_SAMPLE_RATIO0–1 float1 local; 0.1 production.
OBSERVABILITY_CENTRAL_ALLOY_ENDPOINTURLhttps://obs.{domain}:4318 in prod.
OBSERVABILITY_CENTRAL_LOKI_ENDPOINTURLhttps://obs.{domain}:3100/loki/api/v1/push
OBSERVABILITY_CENTRAL_MIMIR_ENDPOINTURLhttps://obs.{domain}:9009/api/v1/push

Local Docker apps use http://host.docker.internal:… for the three central endpoints. Without them, Alloy stays standalone.

Compose image pins (production) ​

Required by docker/compose/docker-compose.yml. Format: name@sha256:<64 hex> (or a fully qualified digest reference). Floating :latest tags are not a production pin.

VariableImage
WEB_IMAGEPlayer Next.js
API_IMAGEHono API (+ migrate/job sidecars that reuse it)
ADMIN_IMAGEAdmin
SUPPORT_IMAGESupport
P2P_IMAGEP2P
PROMO_IMAGEPromo
STREAMER_IMAGEAnalytics worker
NOTIFIER_IMAGENotifier
CUSTOMERIO_IMAGECustomer.io worker
REALTIME_IMAGERealtime worker
SCHEDULER_IMAGEScheduler (8793)
POSTGRES_IMAGEPostgres

Pin these in both current/.env and shared/main.env. See Production.

Observability host ​

File: observability/.env (example: observability/.env.example). Zip deploy also copies /opt/swaggbet/shared/observability.env.

VariableFormat / valuesNotes
GRAFANA_ADMIN_USERstring, default admin
GRAFANA_ADMIN_PASSWORDsecretGenerated on first install.
GRAFANA_HOST_PORTintegerLocal 3300; production behind nginx uses 3000.
GRAFANA_ROOT_URLURLPublic Grafana URL.
GRAFANA_ALERT_WEBHOOK_URLHTTPS URL or emptyOptional extra sink on ops-alerts. Never http://127.0.0.1:9.
GRAFANA_ALERT_WEBHOOK_BEARER_TOKENsecret or emptyOmit entirely if unused.
TELEGRAM_ALERT_BOT_TOKEN123456:ABC…Both Telegram vars required to provision the contact point.
TELEGRAM_ALERT_CHAT_IDinteger string (may be negative)Group ids like -100….
OBSERVABILITY_BIND_ADDRESSIP, default 127.0.0.1Docker publish bind.
OBS_INGEST_ALLOW_CIDRSCIDR listExtra public IPs allowed to hit 4318/3100/9009.
ALLOY_HTTP_HOST_PORTinteger, default 12345Production remaps so nginx owns public ingest.
ALLOY_OTLP_GRPC_HOST_PORTinteger, default 4317
ALLOY_OTLP_HTTP_HOST_PORTinteger, default 4318
LOKI_HOST_PORT / TEMPO_HOST_PORT / MIMIR_HOST_PORTintegers 3100 / 3200 / 9009
MINIO_ROOT_USER / MINIO_ROOT_PASSWORDstring + secretObject storage.
LOKI_RETENTION_PERIODGo duration, default 336h14 days.
TEMPO_RETENTION_PERIODdefault 168h7 days.
MIMIR_RETENTION_PERIODdefault 720h30 days.
POSTGRES_HOST / POSTGRES_PORT / POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DATABASEconnection partsMarketing Campaigns datasource. Leave host/user/database empty to skip.
POSTGRES_SSLMODEdisable | require | …Compose default disable; production setup require.
GRAFANA_POSTGRES_NAMEstring, default OmadxDatasource title when multiple clusters share Grafana.
GRAFANA_POSTGRES_UIDstring, default postgres-omadx
OBSERVABILITY_ENVIRONMENTproduction typicalLabel for the monitoring host itself.

Alert routing and dashboards: Monitoring.