forked from Predictify-org/predictify-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.example
More file actions
154 lines (108 loc) · 7.22 KB
/
Copy path.env.example
File metadata and controls
154 lines (108 loc) · 7.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# ──────────────────────────────────────────────────────────────────────────────
# predictify-backend — environment variables
#
# Copy this file to .env and fill in every "required" value before starting.
# Keys marked "(required)" have no default and MUST be set.
# Keys with a default shown are optional — the value here is what you get.
#
# Every key here mirrors the zod schema in src/config/env-schema.ts exactly.
# Run `npm run check-env` at any time to validate your .env without starting
# the server.
# ──────────────────────────────────────────────────────────────────────────────
# ── Application ──────────────────────────────────────────────────────────────
# Runtime mode: development | test | production (default: development)
NODE_ENV=development
# Port the HTTP server binds to (default: 3001)
PORT=3001
# Pino log level: fatal | error | warn | info | debug | trace (default: info)
LOG_LEVEL=info
# ── Database ─────────────────────────────────────────────────────────────────
# PostgreSQL connection string (required)
DATABASE_URL=postgres://postgres:postgres@localhost:5432/predictify
PG_POOL_MAX=10
PG_STATEMENT_TIMEOUT_MS=5000
# ── JWT ──────────────────────────────────────────────────────────────────────
# Random secret ≥ 32 characters (required)
# Generate one with: openssl rand -hex 32
JWT_SECRET=replace-with-at-least-32-character-random-secret-here
# Token issuer claim (iss) (default: predictify)
JWT_ISSUER=predictify
# Token audience claim (aud) (default: predictify-app)
JWT_AUDIENCE=predictify-app
# Token lifetime in seconds (default: 3600 = 1 hour)
JWT_TTL_SECONDS=3600
# Minimum internal interval between worker heartbeats; JWT_TTL_SECONDS must be >= this * 2
WORKER_HEARTBEAT_SECONDS=30
# Additional signing/verification keys for rotation (optional).
# Comma-separated "kid:secret" pairs; each secret >= 32 chars. JWT_SECRET
# above is always loaded too, under the reserved kid "default".
# See docs/jwt-rotation.md and the rotation script: npm run jwt:rotate
# JWT_KEYS=2026-07-01:7f3c9c2c4f0c4d5a8e9b1a2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f6
# kid used to sign *new* tokens (default: "default", i.e. JWT_SECRET)
# JWT_ACTIVE_KID=2026-07-01
# Webhooks
WEBHOOK_SIGNING_SECRET=replace-with-16+byte-random-string
# ── CORS Allowlists ──────────────────────────────────────────────────────────
# Comma-separated list of origins allowed to make cross-origin requests
# to the webhooks endpoint. Leave empty to deny all origins.
# WEBHOOK_CORS_ALLOWED_ORIGINS=https://admin.predictify.dev,https://app.predictify.dev
# Comma-separated list of origins allowed to make cross-origin requests
# to the markets endpoint. Leave empty to deny all origins (deny by default).
# MARKETS_CORS_ALLOWED_ORIGINS=https://app.predictify.dev,https://staging.predictify.dev
# Comma-separated list of origins allowed to make cross-origin requests
# to the audit endpoint. Leave empty to deny all origins (deny by default).
# AUDIT_CORS_ALLOWED_ORIGINS=https://admin.predictify.dev
# ── Stellar / Soroban ────────────────────────────────────────────────────────
# Network to connect to: testnet | mainnet (default: testnet)
STELLAR_NETWORK=testnet
# Observability
METRICS_AUTH_TOKEN=
# Shared secret for internal job-trigger endpoints under /api/internal/jobs
# (e.g. POST /api/internal/jobs/cleanup-idempotency-keys). Leave unset to
# disable those endpoints entirely (they return 404).
INTERNAL_JOB_TOKEN=
# Indexer
INDEXER_POLL_INTERVAL_MS=5000
# Ledger sequence number to start indexing from (default: 0 = latest tip)
INDEXER_START_LEDGER=0
# Lag alert threshold in ledgers; probe warns when (chain tip − cursor) exceeds this (default: 200)
INDEXER_LAG_ALERT_THRESHOLD=200
# Admin Allowlist (comma separated stellar addresses)
ADMIN_ALLOWLIST=
# ── Anonymous rate limiting ──────────────────────────────────────────────────
# Sliding window for anonymous /api/markets and /api/leaderboard traffic (ms)
ANON_RATE_LIMIT_WINDOW_MS=60000
# Max anonymous requests per IP per window
ANON_RATE_LIMIT_MAX=60
# ── Per-user concurrency limit ────────────────────────────────────────────────
# Maximum number of in-flight (concurrent) /api requests allowed per user
# (or per IP for anonymous callers) at any given moment. Requests exceeding
# this cap receive HTTP 429 with `Retry-After: 1`. Set to a large value
# (e.g. 1000) to effectively disable the limit. (default: 10)
# MAX_CONCURRENT_REQUESTS_PER_USER=10
# ── Invites rate limiting (per user, token bucket) ──────────
# Max number of consecutive /api/invites requests allowed in the window (default: 60)
# INVITES_RATE_LIMIT_CAPACITY=60
# Token-bucket refill window in milliseconds (default: 60000)
# INVITES_RATE_LIMIT_WINDOW_MS=60000
# ── Exports rate limiting (per user, token bucket) ──────────
# Max number of consecutive /api/exports requests allowed in the window (default: 60)
# EXPORTS_RATE_LIMIT_CAPACITY=60
# Token-bucket refill window in milliseconds (default: 60000)
# EXPORTS_RATE_LIMIT_WINDOW_MS=60000
# ── Login IP rate limiting ────────────────────────────────────────────────────
# Sliding window for IP-based login rate limiting (ms)
LOGIN_RATE_LIMIT_WINDOW_MS=60000
# Max login requests (challenge/verify) per IP per window
LOGIN_RATE_LIMIT_MAX=10
# Set true when running behind a trusted reverse proxy (honours X-Forwarded-For)
TRUST_PROXY=false
# ── Backup verification (src/workers/backupVerifier.ts) ─────────────────────
# Absolute path to the pg_dump file to restore (required by backupVerifier)
# BACKUP_DUMP_PATH=/backups/predictify_latest.dump
# Connection string for the throwaway ephemeral database (required by backupVerifier)
# BACKUP_EPHEMERAL_DB_URL=postgres://postgres:postgres@localhost:5433/predictify_verify
# Slack Incoming Webhook URL for backup-verification notifications (optional)
# BACKUP_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T000/B000/XXXX
# Smoke-test query timeout in milliseconds (default: 15000)
# BACKUP_SMOKE_TIMEOUT_MS=15000