[object Object]

← back to All Designerwallcoverings

all.dw: make microsite feed ports env-overridable (MICROSITE_FEED_PORTS)

c22ea62536a1f0f000d01b9fa05d91d5839780d2 · 2026-07-09 16:20:45 -0700 · Steve

Prod's co-located internal viewers listen on different localhost ports than Mac2
dev (prod: fromental=10103/gracie=10104/zuber=10105/crezana=10106; dev defaults
10071/10073/10074/10072). Drive the per-line feed port from MICROSITE_FEED_PORTS
("slug=port,..."), falling back to the dev default so behavior is unchanged when
unset. Keeps the ingest portable across environments without hardcoding prod ports.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit c22ea62536a1f0f000d01b9fa05d91d5839780d2
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Jul 9 16:20:45 2026 -0700

    all.dw: make microsite feed ports env-overridable (MICROSITE_FEED_PORTS)
    
    Prod's co-located internal viewers listen on different localhost ports than Mac2
    dev (prod: fromental=10103/gracie=10104/zuber=10105/crezana=10106; dev defaults
    10071/10073/10074/10072). Drive the per-line feed port from MICROSITE_FEED_PORTS
    ("slug=port,..."), falling back to the dev default so behavior is unchanged when
    unset. Keeps the ingest portable across environments without hardcoding prod ports.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 server.js | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/server.js b/server.js
index e396bc1..b12101e 100644
--- a/server.js
+++ b/server.js
@@ -445,11 +445,26 @@ function deriveRow(r) {
 // public 401), normalizing to the grid row shape, and merging into the searchable set.
 // These are CUSTOMER-FACING brands (not private-label), so their real vendor names are fine.
 // Fully additive + guarded: an unreachable feed is skipped, never breaks the grid.
+// Each line's co-located internal viewer serves its FULL catalog at /api/products on a localhost
+// port. The port DIFFERS per environment (Mac2 dev vs Kamatera prod), so it's env-overridable:
+// set MICROSITE_FEED_PORTS="fromental=PORT,gracie=PORT,zuber=PORT,crezana=PORT" to point at prod's
+// ports. Defaults are the Mac2 dev ports. An unset/partial override falls back to the default port.
+const MICROSITE_DEFAULT_PORTS = { fromental: 10071, gracie: 10073, zuber: 10074, crezana: 10072 };
+const MICROSITE_PORT_OVERRIDE = (() => {
+  const m = {};
+  for (const pair of String(process.env.MICROSITE_FEED_PORTS || '').split(',')) {
+    const [k, v] = pair.split('='); const port = parseInt((v || '').trim(), 10);
+    if (k && port) m[k.trim().toLowerCase()] = port;
+  }
+  return m;
+})();
+const micrositePort = (slug) => MICROSITE_PORT_OVERRIDE[slug] || MICROSITE_DEFAULT_PORTS[slug];
+const micrositeFeedUrl = (slug) => `http://127.0.0.1:${micrositePort(slug)}/api/products?limit=100000`;
 const MICROSITE_FEEDS = [
-  { vendor: 'Fromental',       slug: 'fromental', url: 'http://127.0.0.1:10071/api/products?limit=100000', type: 'Wallcovering' },
-  { vendor: 'Gracie',         slug: 'gracie',    url: 'http://127.0.0.1:10073/api/products?limit=100000', type: 'Wallcovering' },
-  { vendor: 'Zuber',          slug: 'zuber',     url: 'http://127.0.0.1:10074/api/products?limit=100000', type: 'Wallcovering' },
-  { vendor: 'Crezana Design', slug: 'crezana',   url: 'http://127.0.0.1:10072/api/products?limit=100000', type: 'Fabric' },
+  { vendor: 'Fromental',       slug: 'fromental', url: micrositeFeedUrl('fromental'), type: 'Wallcovering' },
+  { vendor: 'Gracie',         slug: 'gracie',    url: micrositeFeedUrl('gracie'),    type: 'Wallcovering' },
+  { vendor: 'Zuber',          slug: 'zuber',     url: micrositeFeedUrl('zuber'),     type: 'Wallcovering' },
+  { vendor: 'Crezana Design', slug: 'crezana',   url: micrositeFeedUrl('crezana'),   type: 'Fabric' },
 ];
 const MICROSITE_PER_SITE_CAP = 800;   // full catalog per site is ≤735 — well under this
 // Shared internal cred so the localhost feeds (Basic-Auth gated, the 401 is the healthy signal)

← b2fc39c all.dw: surface 4 luxury lines (Fromental/Gracie/Zuber/Creza  ·  back to All Designerwallcoverings  ·  microsite crawler: seed from Cloudflare zone (authoritative, 9d3836e →