[object Object]

← back to Reidwitlin Landing

chore: pin port + stable .env credential via pm2, guarded dotenv, v0.2.2 (session close)

a206855b203e4cc75677b6ea547ccbcb428c3847 · 2026-07-06 18:28:55 -0700 · Steve

Files touched

Diff

commit a206855b203e4cc75677b6ea547ccbcb428c3847
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 6 18:28:55 2026 -0700

    chore: pin port + stable .env credential via pm2, guarded dotenv, v0.2.2 (session close)
---
 ecosystem.config.js | 14 ++++++++++++++
 package-lock.json   | 17 +++++++++++++++--
 package.json        |  3 ++-
 server.js           |  1 +
 4 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/ecosystem.config.js b/ecosystem.config.js
new file mode 100644
index 0000000..972895d
--- /dev/null
+++ b/ecosystem.config.js
@@ -0,0 +1,14 @@
+// pm2 launcher for the Reid Witlin internal landing.
+// Pins the port so it's stable across restarts (bare `node server.js` left PORT
+// unset → random port). The BASIC_AUTH credential is NOT hardcoded here — it is
+// read from the gitignored .env via dotenv (server.js) so no secret is committed.
+module.exports = {
+  apps: [{
+    name: 'reidwitlin-landing',
+    script: 'server.js',
+    cwd: __dirname,
+    env: { PORT: 9952 },   // credential comes from .env, not this committed file
+    autorestart: true,
+    max_restarts: 20,
+  }],
+};
diff --git a/package-lock.json b/package-lock.json
index 608bdb2..d186134 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,13 +1,14 @@
 {
   "name": "reidwitlin-landing",
-  "version": "0.2.1",
+  "version": "0.2.2",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "reidwitlin-landing",
-      "version": "0.2.1",
+      "version": "0.2.2",
       "dependencies": {
+        "dotenv": "^17.4.2",
         "express": "^4.19.2",
         "pg": "^8.22.0"
       }
@@ -157,6 +158,18 @@
         "npm": "1.2.8000 || >= 1.4.16"
       }
     },
+    "node_modules/dotenv": {
+      "version": "17.4.2",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
+      "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
+      "license": "BSD-2-Clause",
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://dotenvx.com"
+      }
+    },
     "node_modules/dunder-proto": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
diff --git a/package.json b/package.json
index 3dc2ccb..2ee89b3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "reidwitlin-landing",
-  "version": "0.2.1",
+  "version": "0.2.2",
   "private": true,
   "description": "Editorial vendor landing for Reid Witlin — a Designer Wallcoverings private label (INTERNAL dw_unified.rwltd_catalog — not on Shopify)",
   "scripts": {
@@ -8,6 +8,7 @@
     "start": "node server.js"
   },
   "dependencies": {
+    "dotenv": "^17.4.2",
     "express": "^4.19.2",
     "pg": "^8.22.0"
   }
diff --git a/server.js b/server.js
index 22fb1ec..b09cefe 100644
--- a/server.js
+++ b/server.js
@@ -2,6 +2,7 @@
    INTERNAL DATA ONLY: catalog is dw_unified.rwltd_catalog (NOT on Shopify).
    Self-contained: reads data/products.json. Links resolve to this site's OWN
    internal PDPs and a memo-sample/inquiry CTA — never Shopify, never rwltd.com. */
+try { require('dotenv').config(); } catch { /* dotenv optional; pm2 env block also sets these */ }
 const express = require('express');
 const fs = require('fs');
 const path = require('path');

← 98a3a2a Retrofit front page to the internal-line-viewer spec (astek  ·  back to Reidwitlin Landing  ·  Fix systemic color mislabel: derive colorway from mfr_sku + 941c6a2 →