Skip to content

Configuration ​

Validated runtime settings live in packages/api/src/config.ts and packages/custody/src/config.ts (envalid). Names below are canonical; missing required settings fail startup. Numeric defaults are product/operational policy, not poker or blockchain protocol rules. _MS means milliseconds, _SECONDS seconds, _COUNT attempts, _SIZE rows, and _LIMIT counts in the configured risk window. Do not log environment values or pass one package's secrets to another.

API and room workers ​

SettingType / defaultMeaning / production constraint
NODE_ENVenum development/production/test; developmentProduction enables fail-closed deployment checks
HOST, PORTstring 0.0.0.0, number 3000Listen address/port; production API stays internal
DATABASE_URLrequired stringProduction requires PostgreSQL; file: is disposable local-test only
REDIS_URLstring redis://localhost:6379Required explicitly in production; cache/queue, never authority
JWT_SECRET, COOKIE_SECRETrequired stringsProduction ≥32 characters, reject known dev defaults; generate independently
CORS_ORIGINstring emptyRequired explicit production origin
LOG_LEVELdebug/info/warn/error; infoNever log tokens/keys/private state
ALLOWED_SIWE_CHAIN_IDSCSV string 1,31337EIP-155 login chains; set actual supported chains in production
SESSION_TTL_SECONDS, NONCE_TTL_SECONDSnumbers 604800, 300Session lifetime and single-use SIWE nonce TTL
METRICS_TOKENstring emptyEmpty disables production metrics; otherwise bearer-protected
ENABLE_TEST_ROUTEStrue/false string; falseOnly isolated tests; production rejects true
RATE_LIMIT_MAXnumber 100Global requests/minute/IP
AUTH_NONCE_RATE_LIMIT_MAX, AUTH_LOGIN_RATE_LIMIT_MAXnumbers 5, 10Auth requests/minute/IP
TABLE_REDIS_TTL_SECONDSnumber 86400Cache TTL, not durable retention
TABLE_LOCK_TTL_MS, TABLE_LOCK_TTL_MS_TESTnumbers 10000, 15000Coordination lock TTLs
ACTION_TIMEOUT_SECONDS, AUTO_DEAL_DELAY_MSnumbers 30, 5000Turn default and next-hand delay
TABLE_LISTING_PAGE_SIZE, TOURNAMENT_LISTING_PAGE_SIZEnumbers 50, 100Listing bounds
TOURNAMENT_BLIND_INTERVAL_MS, TOURNAMENT_BLIND_SCAN_INTERVAL_MSnumbers 900000, 15000Blind level default and worker cadence
MAX_TOURNAMENT_TABLESnumber 10Multi-table product limit
TOURNAMENT_LOCK_TTL_MSnumber 30000Tournament coordination TTL
SETTLE_HAND_LOCK_TTL_MS, NEXT_HAND_LOCK_TTL_MSnumbers 5000, 3000Worker lock TTLs
GAME_OUTBOX_SWEEP_INTERVAL_MSnumber 5000Durable delivery recovery cadence
CANONICAL_DEPOSIT_MONITOR_INTERVAL_MSnumber 30000Deposit finality/reorg scan cadence
RECONCILIATION_INTERVAL_MS, RECONCILIATION_BATCH_SIZEnumbers 300000, 100Reconciliation cadence/batch rows
REDLOCK_RETRY_COUNT, REDLOCK_RETRY_COUNT_TESTnumbers 50, 5000Coordination retry attempts
REDLOCK_RETRY_DELAY_MS, REDLOCK_RETRY_DELAY_MS_TESTnumbers 100, 2Retry delay
REDLOCK_RETRY_JITTER_MS, REDLOCK_RETRY_JITTER_MS_TESTnumbers 100, 2Retry jitter
REDLOCK_DRIFT_FACTORnumber 0.01Clock-drift allowance
RETRY_TRANSIENT_ATTEMPTS, RETRY_TRANSIENT_BACKOFF_BASE_MSnumbers 10, 100Safe read retry policy, not blockchain replacement
WS_MAX_CONNECTIONS_PER_USER, WS_MAX_PRE_AUTH_QUEUEnumbers 4, 32Socket connection/pre-auth buffering limits
WS_HEARTBEAT_INTERVAL_MSnumber 30000Socket heartbeat cadence
RISK_SCORE_THRESHOLD, RISK_SCORING_WINDOW_MSnumbers 70, 60000Velocity scoring cutoff/window
RISK_WITHDRAW_USER_LIMIT, RISK_BUY_IN_USER_LIMIT, RISK_ACTION_USER_LIMITnumbers 5, 12, 60Per-principal request limits
RISK_WITHDRAW_IP_LIMIT, RISK_BUY_IN_IP_LIMIT, RISK_ACTION_IP_LIMITnumbers 20, 40, 200Per-IP request limits
RISK_USER_COUNT_THRESHOLD, RISK_USER_COUNT_SCOREnumbers 20, 40Principal velocity score
RISK_IP_COUNT_THRESHOLD, RISK_IP_COUNT_SCOREnumbers 80, 25IP velocity score
RISK_MEDIUM_CHIP_AMOUNT_THRESHOLD, RISK_MEDIUM_CHIP_AMOUNT_SCOREnumbers 100000, 20Chip-sized request score, not atomic assets/cents
RISK_HIGH_CHIP_AMOUNT_THRESHOLD, RISK_HIGH_CHIP_AMOUNT_SCOREnumbers 500000, 30High chip-sized request score

Amount-risk settings use chips. The obsolete RISK_*_AMOUNT_CENTS_* names are not aliases. Asset limits, addresses, RPC pools, gas atomic thresholds and confirmation/finality block depths belong to validated Asset/policy records, not scattered environment overrides. EIP-712 fields/domain version are protocol invariants and cannot be overridden.

SQLITE_BUSY_TIMEOUT_MS is an adapter-only local-test setting (default 15000), read when constructing the SQLite adapter; it never affects PostgreSQL.

Custody only ​

SettingType / defaultConstraint
NODE_ENVenum; developmentProduction is explicit
DATABASE_URLrequired stringProduction PostgreSQL; separate worker access
LOG_LEVELstring infoSigning values must never be logged
TREASURY_SIGNING_KEYS_JSONJSON string empty{chainId: "0x…"} treasury keys; required valid nonempty in production
CUSTODY_WORKER_INTERVAL_MSnumber 5000Withdrawal/recovery cadence
CUSTODY_RECONCILE_INTERVAL_MSnumber 300000Treasury reconciliation cadence
CUSTODY_QUORUM_THRESHOLD, CUSTODY_MIN_QUORUMnumbers 2, 2Independent endpoint agreement requirements

Monitoring-only empty keys are development/test only. Custody does not consume API JWT/cookie secrets, Redis, mnemonic/xpriv or Telegram configuration. The API rejects configured custody key/decryption names even outside production; forbidden names are guards, not supported configuration options.

Deployment and tooling ​

Root .env.example configures Compose API/workers/backup/Caddy only. deploy/.env.custody.example is copied to required .env.custody, supplied only to custody. See the runbook for CADDY_DOMAIN, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, REDIS_PASSWORD, BACKUP_INTERVAL, BACKUP_RETENTION_DAYS and volume policy. These are container/tool settings, not silently consumed application secrets.

Tests/benchmarks have explicitly isolated controls (POKERTOOLS_LOOPBACK_TEST, ENABLE_HEAVY_TESTS, POKERTOOLS_PLAYWRIGHT_MODULE, POKERTOOLS_E2E_RUNTIME, PT_FINANCE_*, BENCH_*); never use them to admit production. Secret scanning uses GITLEAKS_BIN and optional POKERTOOLS_TEST_TMPDIR as documented in secret scanning.

Released under the MIT License.