[object Object]

← back to George Gmail

fix(george): ENV_PATH portable across Mac2/Kamatera

a4d0448e1a2b46750ff0eadfa4927177afe60db6 · 2026-05-12 08:47:06 -0700 · Steve Abrams

ENV_PATH was hardcoded to /root/Projects/Designer-Wallcoverings/DW-MCP/.env
which only exists on Kamatera. On Mac2 the same .env lives at
~/Projects/Designer-Wallcoverings/DW-MCP/.env. The readFileSync would
quietly fail in the try/catch upstream, INFO_REFRESH_TOKEN stayed empty,
and the boot log said 'Info@ not configured' even though the token IS
in the Mac2 .env.

Fix: try $DW_MCP_ENV then $HOME/Projects/.../DW-MCP/.env then the
legacy /root/ path. First readable wins.

Symptom that exposed this: GET /api/search?account=info returned
'unknown account: info' because infoGmail was never built. After
restart with the fix, log says 'Info@ account initialized (full
Workspace)' and /api/search returns the real DW inbox (201 messages
for a Shopify-orders query, including 'New Order on the New DW').

Files touched

Diff

commit a4d0448e1a2b46750ff0eadfa4927177afe60db6
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 12 08:47:06 2026 -0700

    fix(george): ENV_PATH portable across Mac2/Kamatera
    
    ENV_PATH was hardcoded to /root/Projects/Designer-Wallcoverings/DW-MCP/.env
    which only exists on Kamatera. On Mac2 the same .env lives at
    ~/Projects/Designer-Wallcoverings/DW-MCP/.env. The readFileSync would
    quietly fail in the try/catch upstream, INFO_REFRESH_TOKEN stayed empty,
    and the boot log said 'Info@ not configured' even though the token IS
    in the Mac2 .env.
    
    Fix: try $DW_MCP_ENV then $HOME/Projects/.../DW-MCP/.env then the
    legacy /root/ path. First readable wins.
    
    Symptom that exposed this: GET /api/search?account=info returned
    'unknown account: info' because infoGmail was never built. After
    restart with the fix, log says 'Info@ account initialized (full
    Workspace)' and /api/search returns the real DW inbox (201 messages
    for a Shopify-orders query, including 'New Order on the New DW').
---
 public/index.html |  2 ++
 server.js         | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/public/index.html b/public/index.html
index f33cf45..81bbc28 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,6 +1,8 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
+    <link rel="icon" type="image/svg+xml" href="/favicon.svg">
+
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>George — Gmail Agent</title>
diff --git a/server.js b/server.js
index d82a3a7..39b4a2d 100644
--- a/server.js
+++ b/server.js
@@ -16,7 +16,23 @@ const AGENT_CODENAME = 'Gmail';
 const AGENT_COLOR = '#EA4335';
 
 // ─── Gmail OAuth Credentials (loaded from DW-MCP .env) ───
-const ENV_PATH = '/root/Projects/Designer-Wallcoverings/DW-MCP/.env';
+// Portable across Mac2 (~/Projects/...) and Kamatera (/root/Projects/...).
+// Try $HOME first, fall back to the legacy Kamatera path so we don't break
+// the Kamatera deploy. Source of this fix: 2026-05-12 — on Mac2 the
+// hardcoded /root/ path silently fails the readFileSync (caught by try/catch
+// upstream) and George boots without INFO_REFRESH_TOKEN → "Info@ not
+// configured" even though the token IS in ~/Projects/.../.env.
+const ENV_PATH = (() => {
+  const tryPaths = [
+    process.env.DW_MCP_ENV,
+    require('path').join(process.env.HOME || '', 'Projects/Designer-Wallcoverings/DW-MCP/.env'),
+    '/root/Projects/Designer-Wallcoverings/DW-MCP/.env',
+  ].filter(Boolean);
+  for (const p of tryPaths) {
+    try { require('fs').accessSync(p, require('fs').constants.R_OK); return p; } catch {}
+  }
+  return tryPaths[tryPaths.length - 1];
+})();
 const creds = {};
 try {
   const envContent = fs.readFileSync(ENV_PATH, 'utf8');

← facbb3b initial scaffold (gitify-all 2026-05-06)  ·  back to George Gmail  ·  george /auth honors ?account= — dispatches to per-account re ec801aa →