[object Object]

← back to Dw Signup Fulfillment

preflight: load ecosystem env as fallback so standalone runs reflect live pm2 config

f975a4dc90187164921fdc5f5f7a2005e38d46d6 · 2026-08-26 12:35:17 -0700 · steve-office

Files touched

Diff

commit f975a4dc90187164921fdc5f5f7a2005e38d46d6
Author: steve-office <steve@designerwallcoverings.com>
Date:   Wed Aug 26 12:35:17 2026 -0700

    preflight: load ecosystem env as fallback so standalone runs reflect live pm2 config
---
 scripts/golive-preflight.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/golive-preflight.js b/scripts/golive-preflight.js
index 54a9a9b..4f543c2 100644
--- a/scripts/golive-preflight.js
+++ b/scripts/golive-preflight.js
@@ -13,6 +13,15 @@
 const fs = require('fs');
 const path = require('path');
 const http = require('http');
+// When run standalone (not under pm2), pull the same env pm2 injects from ecosystem.config.js
+// so the preflight reflects the LIVE process config (DRY_RUN/PORT/PUBLIC_URL) instead of the
+// code defaults in lib/config.js. No-override: keys already in process.env (i.e. a real pm2 run,
+// or the secrets-master-resolved tokens) win. Must run BEFORE requiring ../lib/config.
+try {
+  const eco = require('../ecosystem.config.js');
+  const envs = (eco.apps && eco.apps[0] && eco.apps[0].env) || {};
+  for (const [k, v] of Object.entries(envs)) if (process.env[k] === undefined) process.env[k] = String(v);
+} catch (e) { /* ecosystem.config.js absent — fall back to lib/config.js code defaults */ }
 const config = require('../lib/config');
 
 const checks = [];

← 081fb31 snapshot before restart: preserve in-flight work  ·  back to Dw Signup Fulfillment  ·  chore: version bump (session close) 7b6cce3 →