games_app/backend/dist/config/index.d.ts

207 lines
7.7 KiB
TypeScript

/**
* Application configuration loaded from environment variables.
* Centralizes defaults for server, database, JWT, encryption, blockchain, and safety settings.
*/
/** Resolved runtime configuration derived from process.env with safe defaults. */
export declare const config: {
env: string;
port: number;
apiPrefix: string;
database: {
url: string;
};
jwt: {
secret: string;
accessExpiry: string;
refreshExpiry: string;
};
encryption: {
key: string;
};
blockchain: {
tron: {
nodeUrl: string;
apiKey: string;
confirmations: number;
/** Optional override for USDT TRC20 contract (e.g. testnet token). When set, used instead of DB wallet_types.contract_address. */
usdtTrc20Contract: string | null;
};
polygon: {
rpcUrl: string;
usdcContract: string;
confirmations: number;
/** Max blocks per eth_getLogs call; Amoy public RPC rejects ~500-block ranges */
getLogsBlockRange: number;
};
bsc: {
rpcUrl: string;
/**
* Extra RPCs tried for eth_getLogs when the primary returns -32005 / limit exceeded.
* Public Binance dataseeds often ban getLogs; rpc-bsc.48.club is the reliable free fallback.
* (1rpc.io often returns 403 from datacenter / VPS IPs — do not list it by default.)
*/
rpcFallbacks: string[];
/** Optional override; otherwise DB wallet_types.contract_address for USDT_BEP20 */
usdtBep20Contract: string | null;
confirmations: number;
getLogsBlockRange: number;
/**
* First-scan / balance catch-up lookback (~3s/block → 200k ≈ 7 days).
* Missed deposits older than this need manual creditByTx.
*/
depositInitialLookbackBlocks: number;
/** Re-scan overlap each poll to survive empty eth_getLogs / late indexing. */
depositOverlapLookbackBlocks: number;
/**
* When HD still holds USDT (missed credit), rescan this many recent blocks via getLogs.
* Must be wide enough for deposits missed while public RPCs were rate-limiting
* (≈3s/block → 200000 ≈ 7 days). Used as floor with depositInitialLookbackBlocks.
*/
unpaidLookbackBlocks: number;
/** Optional Etherscan V2 / BscScan key for unpaid deposit fallback. */
explorerApiKey: string;
/**
* Optional Etherscan-compatible tokentx API. Default empty: Blockscout BSC host is often 404;
* deposit recovery relies on RPC fallbacks (+ BSCSCAN_API_KEY when set).
*/
explorerApiUrl: string;
/** Native BNB top-up for sweeps (wei); default 0.001 BNB */
gasTopUpWei: string;
};
};
rateLimit: {
windowMs: number;
max: number;
loginMax: number;
};
withdrawal: {
dailyLimitUsd: number;
largeThresholdUsd: number;
/** Kill-switch: prevents broadcasting real chain txs unless explicitly enabled */
allowWithdrawals: boolean;
/** Default network fee in USDT micro-units (6 decimals); admin can override in Settings. */
networkFeeUsdtMicro: number;
};
security: {
integrityCheckIntervalMs: number;
/** When set, overrides DB setting `require_admin_2fa` (use `false` for local Docker dev). */
requireAdmin2faEnv: string | null;
/** Skips JWT token_version check (enabled automatically in NODE_ENV=test). */
skipAccessTokenVersionCheck: boolean;
};
treasury: {
/** Moves on-chain deposits from user addresses to cold storage */
sweepEnabled: boolean;
/**
* When true, pending sweeps execute on-chain without Approvals (after safety checks).
* Default false — keep human approval for cold destination / amount review.
*/
sweepAutoExecute: boolean;
/**
* Optional raw-unit cap for auto-execute. Above this amount, sweep stays pending
* for Submit sweeps → Approvals. Empty = no cap when SWEEP_AUTO_EXECUTE=true.
*/
sweepAutoMaxAmountRaw: string;
/**
* Optional comma-separated cold addresses allowed as sweep destinations (EVM lowercased).
* When set, active cold must match; blocks sweeps if DB cold was changed to an unknown address.
*/
sweepColdAllowlist: string[];
sweepPollIntervalMs: number;
/** Minimum token amount (raw units) to sweep */
sweepMinAmountRaw: string;
/** TRX sent from hot wallet to fund TRC20 sweeps (sun) */
tronGasTopUpSun: string;
/**
* Min USDT (chain raw units) to leave on hot after Hot→Cold USDT transfer.
* Default 0 = no USDT floor (native withdrawal gas reserve still enforced).
*/
hotUsdtMinReserveRaw: string;
/** MATIC sent from hot wallet to fund USDC sweeps (wei) */
polygonGasTopUpWei: string;
};
app: {
/** Public web app URL used in verification links (e.g. http://localhost:5173) */
publicUrl: string;
verifyEmailPath: string;
resetPasswordPath: string;
/** Comma-separated allowed CORS origins in production */
corsOrigins: string[];
};
countries: {
/** Optional REST Countries v5 API key. When unset, sync uses the ISO 3166 public catalog. */
restCountriesApiKey: string;
};
deposit: {
/** Platform asset for deposits and predictions (USDT TRC20). */
walletTypeCode: string;
};
candlePredict: {
engineTickMs: number;
backfillMaxPerTick: number;
backfillIntervalMs: number;
backfillSeedMax: number;
};
email: {
/** smtp = send via SMTP; console = log link to stdout (dev) */
transport: "smtp" | "console";
host: string;
port: number;
secure: boolean;
user: string;
pass: string;
from: string;
verificationExpiryHours: number;
verificationSendMax: number;
passwordResetExpiryHours: number;
passwordResetSendMax: number;
};
slack: {
/** Legacy fallback when channel-specific webhooks are not set */
webhookUrl: string;
/** #security — withdrawals, auth, platform security alerts */
securityWebhookUrl: string;
/** #referral-fraud — cap blocks, clawbacks, Sybil review */
referralWebhookUrl: string;
};
redis: {
url: string;
/** Auto-enabled when REDIS_URL is set unless REDIS_ENABLED=false */
enabled: boolean;
/** Phase B: read round state from Redis before PostgreSQL */
roundCacheEnabled: boolean;
/** Phase B+: enqueue single bets to Redis Stream (requires worker-bets) */
betAsyncEnabled: boolean;
};
ws: {
enabled: boolean;
port: number;
path: string;
supportPath: string;
securityPath: string;
};
/** When false, API process skips starting game engines (use app-engine instead) */
engineEnabled: boolean;
setup: {
/**
* One-time secret for creating the first administrator on a fresh deployment.
* Set INITIAL_SETUP_TOKEN in production (min. 32 random characters).
*/
token: string;
};
turnstile: {
siteKey: string;
secretKey: string;
};
sentry: {
dsn: string;
tracesSampleRate: number;
};
clamav: {
enabled: boolean;
host: string;
port: number;
timeoutMs: number;
};
};
//# sourceMappingURL=index.d.ts.map