Files
martbost cf0da5044a Review threshold 10 saved IDs (Marty's decision pack answer 2026-11-17; staging was built with 25)
Config default, compose default, page fallbacks, FAQ/guide copy, sprout-meter fallback, asset version bump.
Spotlight $10 / 1,000 views and the 20/5/5/5/5/60 split marked approved as built. unit 35/35, e2e 124/124.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:45:37 -06:00

73 lines
5.6 KiB
JavaScript

// All runtime config comes from env (Coolify sets these). Read once.
// YourProgramBuilder, "the Seed Bed" (yourprogrambuilder.com rebuild; Marty 2026-11-17: "I like the approach on YourProgramBuilder.
// Go ahead and keep fleshing it out more."). An open intake for outside programs:
// PLANT a network member plants a program free: name, referral link with {id}, what it is, cost to join, contract if crypto.
// Every link is checked (linkcheck.js): green shows, yellow waits for Marty's queue, red is refused; rechecked daily.
// SPROUT members save their referral ID in a packet. A visitor through a member sees that member's link first (DownlineHydra's
// wild-head rule, wild.js), then up that member's sponsor line, then the planter's own ID.
// TRANSPLANT at REVIEW_SAVES saves from distinct confirmed network members a packet enters Marty's review queue; approved packets
// are exported for the Crypto Team Build Network builder and DownlineHydra's wild heads, carrying every saved ID.
// Paid part (APPROVED by Marty 2026-11-17, as built): one-time $10 Spotlight = 1,000 guaranteed verified views
// for one packet, paid in POL to YPBShop (../contracts), split on chain in the same transaction: 20% sponsor, 5% each levels 2
// to 5, 60% company; immutable split; members earn for free (a network sign-in + a linked wallet, no purchase needed).
// No recurring charges, ever.
const path = require('path');
let cfg = null;
function get() {
if (cfg) return cfg;
const e = process.env;
const num = (v, d, min, max) => { const n = Number(v); return Number.isFinite(n) && v !== '' && v != null ? Math.min(max, Math.max(min, n)) : d; };
const int = (v, d, min, max) => Math.round(num(v, d, min, max));
const addr = v => /^0x[0-9a-fA-F]{40}$/.test(String(v || '').trim()) ? require('ethers').getAddress(String(v).trim().toLowerCase()) : '';
cfg = {
port: Number(e.PORT || 3000),
isProd: e.NODE_ENV === 'production',
site: e.SITE_HOST || 'yourprogrambuilder.com',
siteName: 'YourProgramBuilder',
siteId: 'yourprogrambuilder', // hub site id, network sign-in audience, netsites id
staging: e.STAGING === '1', // staging only: the admin "mark test member" switch
dataDir: e.DATA_DIR || path.join(__dirname, 'data'),
chainId: Number(e.CHAIN_ID || 137),
chainName: e.CHAIN_NAME || 'Polygon',
publicRpc: e.PUBLIC_RPC || 'https://polygon-bor-rpc.publicnode.com',
walletConnectProjectId: (e.WALLETCONNECT_PROJECT_ID || '').trim(),
// ---- the Seed Bed (10 saves: Marty's decision pack answer 2026-11-17; staging was built with 25) ----
reviewSaves: int(e.REVIEW_SAVES, 10, 2, 1000),
plantQuota: int(e.PLANT_QUOTA, 1, 1, 20), // packets one member may have planted at once (the pack: "plants one program free")
packet: { name: 40, desc: 200, cost: 40 },
recheckHours: int(e.RECHECK_HOURS, 24, 1, 720), // every live packet's link is checked again this often
reportHold: int(e.REPORT_HOLD, 3, 1, 100), // distinct member reports that move a packet back to Marty's queue
viaDays: int(e.VIA_DAYS, 30, 1, 365), // how long a ?ref= / member page tag stays on a visitor (last touch)
// ---- Spotlight (APPROVED 2026-11-17: $10 = 1,000 views, one-time). The contract's SKU holds the real price; this is display copy and must match it.
spotlight: { sku: int(e.SPOTLIGHT_SKU, 1, 1, 1000), usd: num(e.SPOTLIGHT_USD, 10, 0.01, 1000), views: int(e.SPOTLIGHT_VIEWS, 1000, 1, 1000000), maxQty: 10,
deliverDays: int(e.DELIVER_DAYS, 30, 1, 365), row: int(e.SPOTLIGHT_ROW, 3, 1, 12) },
// YPBShop split (APPROVED 2026-11-17: 20 / 5 / 5 / 5 / 5, company 60; IMMUTABLE on the contract, read live from it when the contract is set)
split: { levelBps: String(e.SPLIT_LEVEL_BPS || '2000,500,500,500,500').split(',').map(x => int(x, 0, 0, 9000)).slice(0, 5), maxDepth: 20 },
hubJoin: e.HUB_JOIN === '1', // writes to the hub (join-all). OFF on staging: a dry check instead
payouts: e.PAYOUTS === '1', // staging: OFF (no keeper key, no contract). Orders need KEEPER_KEY + CONTRACT_ADDRESS anyway
// verified visitors (the VBB / ViralAdBlitz rules)
visitSeconds: int(e.VISIT_SECONDS, 6, 2, 60),
perIpDay: int(e.VISITS_PER_IP_DAY, 3, 1, 100),
linkProbe: e.LINK_PROBE !== '0',
explorer: String(e.EXPLORER || (Number(e.CHAIN_ID || 137) === 137 ? 'https://polygonscan.com' : '')).replace(/\/+$/, ''),
// YPBShop (../contracts). KEEPER_KEY is read by shop.js only, never kept here.
contractAddress: addr(e.CONTRACT_ADDRESS),
companyWallet: addr(e.COMPANY_WALLET) || '0x7627Fc78876948AC9d95C1C9eB061E7D6d647b70', // Tangem (immutable in YPBShop)
chainRpc: String(e.CHAIN_RPC || '').trim(),
shopStartBlock: int(e.SHOP_START_BLOCK, 0, 0, 1e12),
shopConfirmations: int(e.SHOP_CONFIRMATIONS, 10, 0, 1000),
shopPollMs: int(e.SHOP_POLL_MS, 30000, 200, 3600000),
voucherSeconds: int(e.VOUCHER_SECONDS, 1800, 60, 86400),
iapBase: String(e.IAP_URL || 'https://instantadpay.com').replace(/\/+$/, ''),
lsBase: String(e.LS_URL || 'https://linkspin.app').replace(/\/+$/, ''),
dhBase: String(e.DH_URL || 'https://downlinehydra.com').replace(/\/+$/, ''),
joinUrl: String(e.JOIN_URL || 'https://instantadpay.com/join/{ref}'),
networkLookupUrl: e.NETWORK_LOOKUP_URL !== undefined ? String(e.NETWORK_LOOKUP_URL).trim()
: String(e.IAP_URL || 'https://instantadpay.com').replace(/\/+$/, '') + '/api/network/member'
};
return cfg;
}
module.exports = { get, reset: () => { cfg = null; } };