[object Object]

← back to Pitch Guard

Move George URL + auth to gitignored .env (was hardcoded in server.js); add .env.example

30852ed10fce5e9c265252328d30accfed633149 · 2026-05-19 11:32:32 -0700 · Steve

Files touched

Diff

commit 30852ed10fce5e9c265252328d30accfed633149
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue May 19 11:32:32 2026 -0700

    Move George URL + auth to gitignored .env (was hardcoded in server.js); add .env.example
---
 server.js | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/server.js b/server.js
index 1e05563..bf577e8 100644
--- a/server.js
+++ b/server.js
@@ -17,14 +17,26 @@ const express = require('express');
 const path = require('path');
 const fs = require('fs');
 
+// ── load .env (gitignored — keeps George creds out of source) ──────────────
+try {
+  for (const line of fs.readFileSync(path.join(__dirname, '.env'), 'utf8').split('\n')) {
+    const m = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/);
+    if (m && process.env[m[1]] === undefined) process.env[m[1]] = m[2].replace(/^["']|["']$/g, '');
+  }
+} catch (e) { /* no .env — rely on real env vars */ }
+
 const app = express();
 app.use(express.json({ limit: '4mb' }));
 app.use(express.static(path.join(__dirname, 'public')));
 
 const PORT = process.env.PORT || 8123;
-const GEORGE = (process.env.GEORGE_URL || 'http://100.107.67.67:9850').replace(/\/$/, '');
-const AUTH = process.env.GEORGE_BASIC_AUTH || 'YWRtaW46STNZdXNpc2RFU1VOZHh0cm1sYjNRSmV1OXE4T0RLSk8=';
+const GEORGE = (process.env.GEORGE_URL || '').replace(/\/$/, '');
+const AUTH = process.env.GEORGE_BASIC_AUTH || '';
 const ACCOUNT = 'info'; // info@designerwallcoverings.com
+if (!GEORGE || !AUTH) {
+  console.error('Missing GEORGE_URL / GEORGE_BASIC_AUTH — copy .env.example to .env and fill it in.');
+  process.exit(1);
+}
 
 // ── George proxy ──────────────────────────────────────────────────────────
 async function george(p, { method = 'GET', query, body } = {}) {

← a2e4c2f Followup scanner now auto-runs: warms on startup + daily, ca  ·  back to Pitch Guard  ·  Add rel=noreferrer to target=_blank link (mechanical safety b193fc5 →