[object Object]

← back to Gracie Internal

Use PostgreSQL sockets and keep Gracie on localhost

966130377ec694055a0688d0e1bd7f4bdf454a93 · 2026-09-11 13:16:16 -0700 · Steve Abrams

Files touched

Diff

commit 966130377ec694055a0688d0e1bd7f4bdf454a93
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Sep 11 13:16:16 2026 -0700

    Use PostgreSQL sockets and keep Gracie on localhost
---
 lib/vendor-requests.js | 2 +-
 server.js              | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/vendor-requests.js b/lib/vendor-requests.js
index cdf81fe..33f6eaf 100644
--- a/lib/vendor-requests.js
+++ b/lib/vendor-requests.js
@@ -49,7 +49,7 @@ const GEORGE_AUTH = firstEnv('GEORGE_BASIC_AUTH', GEORGE_ENVS) || 'admin:';
 
 let pool = null;
 function db() {
-  if (!pool) pool = new Pool({ host: '127.0.0.1', port: 5432, user: 'dw_admin', database: 'dw_unified', password: PGPASS, max: 3 });
+  if (!pool) pool = new Pool({ host: process.env.PGHOST || (process.platform === 'darwin' ? '/tmp' : '127.0.0.1'), port: 5432, user: 'dw_admin', database: 'dw_unified', password: PGPASS, max: 3 });
   return pool;
 }
 
diff --git a/server.js b/server.js
index c6c2a7e..ba2ad55 100644
--- a/server.js
+++ b/server.js
@@ -13,7 +13,7 @@ const path = require('path');
 const fs = require('fs');
 
 const PORT = process.env.PORT || 10073;
-const PG = process.env.PG || 'postgresql://localhost/dw_unified';
+const PG = process.env.PG || (process.platform === 'darwin' ? 'postgresql://localhost/dw_unified?host=/tmp' : 'postgresql://localhost/dw_unified');
 
 // AUTO-DETECT data source: self-contained jsonl bundle (no DB — Kamatera) vs live
 // Postgres (local). jsonl mode when DATA_SOURCE=jsonl OR the bundle exists.
@@ -204,7 +204,7 @@ require('./lib/vendor-requests').mountVendorRequests(app, {
 });
 
 load().then(() => {
-  app.listen(PORT, () => console.log(`Gracie internal viewer → http://127.0.0.1:${PORT} (source=${USE_JSONL ? 'jsonl' : 'pg'})`));
+  app.listen(PORT, '127.0.0.1', () => console.log(`Gracie internal viewer → http://127.0.0.1:${PORT} (source=${USE_JSONL ? 'jsonl' : 'pg'})`));
   // hot-refresh every 10 min so new scrapes/enrichment appear without restart —
   // only against a live DB; the jsonl bundle is static.
   if (!USE_JSONL) setInterval(() => load().catch((e) => console.error('[gracie-internal] reload:', e.message)), 600000);

← 0c7c63a nav-agent: sync v1.3 (host left-sidebar collapse on load)  ·  back to Gracie Internal  ·  Bump gracie-internal to 1.0.1 after verified socket migratio bb7b548 →