Files
wownerogue/src/scripts/preflight.js
T
jwinterm fad2a695bd Wownerogue
A browser-based roguelike synchronized with crypto block timing. A run is a race
against the next block: reach the exit before the block lands, or the house wins.
The same codebase runs the solo dungeon, the social Tavern, and operator-selected
PvP and race rulesets, with separate free and paid leaderboards.

Self-hostable under the MIT License. See README.md to run it, docs/ARCHITECTURE.md
for the design, and docs/DEPLOY.md to operate an instance.
2026-07-27 08:23:01 -04:00

31 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
'use strict';
/**
* Non-mutating production configuration preflight.
*
* This deliberately does not connect to PostgreSQL or either RPC. It catches dangerous operator
* intent before a deploy; the server's normal startup then verifies live dependencies.
*/
require('dotenv').config({ path: process.env.DOTENV_CONFIG_PATH || undefined });
const PaymentConfigManager = require('../config/paymentConfig');
const EnvironmentValidator = require('../config/environmentValidator');
try {
const paymentConfig = new PaymentConfigManager({ logger: console });
const result = new EnvironmentValidator({ logger: console }).assertValid(paymentConfig.getConfig());
const summary = paymentConfig.summarize();
console.log('\n✅ Production configuration preflight passed');
console.log(` chain: ${process.env.CRYPTO_TYPE || 'WOW'} / ${process.env.MONERO_NETWORK || 'mainnet'}`);
console.log(` free play: ${process.env.FREE_PLAY_ENABLED === 'true' || !summary.paymentsEnabled ? 'enabled' : 'disabled'}`);
console.log(` paid modes: ${[summary.directEnabled && 'direct', summary.creditsEnabled && 'credits'].filter(Boolean).join(', ') || 'none'}`);
console.log(` payout dispatch: ${result.money.payoutsEnabled ? 'enabled' : 'disabled'}`);
process.exitCode = 0;
} catch (error) {
console.error(`\n❌ Production configuration preflight failed: ${error.message}`);
process.exitCode = 1;
}