[object Object]

← back to Tools Dw Hub

wire TOOL_HOST/PROBE_HOST for public deploy (tailnet-reachable launch links + probes)

d1d5a15f1f3237fc04d144b5474ad49f3775d504 · 2026-07-28 11:08:55 -0700 · Steve

Files touched

Diff

commit d1d5a15f1f3237fc04d144b5474ad49f3775d504
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Jul 28 11:08:55 2026 -0700

    wire TOOL_HOST/PROBE_HOST for public deploy (tailnet-reachable launch links + probes)
---
 ecosystem.config.js | 8 ++++++--
 public/index.html   | 4 +++-
 server.js           | 7 +++++--
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ecosystem.config.js b/ecosystem.config.js
index 8e3fac9..5402c37 100644
--- a/ecosystem.config.js
+++ b/ecosystem.config.js
@@ -4,9 +4,13 @@ module.exports = {
     script: 'server.js',
     cwd: __dirname,
     env: {
-      PORT: 9815,               // fixed port for pm2/prod; local dev uses 0 (OS-assigned) unless PORT set
+      PORT: 9815,                    // fixed port for pm2/prod
       BASIC_AUTH: 'admin:DW2024!',
-      PROBE_HOST: '127.0.0.1'   // set to the tailnet/Kamatera-local host where the tool apps listen when public
+      PROBE_HOST: '100.82.17.107',   // Mac Studio tailnet IP — where the tool apps actually listen (bind *)
+      TOOL_HOST: '100.82.17.107'     // Launch links resolve here; reachable from any tailnet device
+    },
+    env_local: {
+      PORT: 9815, BASIC_AUTH: 'admin:DW2024!', PROBE_HOST: '127.0.0.1', TOOL_HOST: ''
     },
     autorestart: true,
     max_restarts: 10
diff --git a/public/index.html b/public/index.html
index 183f24f..7c99884 100644
--- a/public/index.html
+++ b/public/index.html
@@ -97,7 +97,8 @@ function render(){
   $('#grid').innerHTML = list.map(t=>{
     const st = STATUS[t.slug]||'na';
     const cls = st==='up'?'up':st==='down'?'down':'na';
-    const url = t.port ? ('http://'+location.hostname+':'+t.port+'/') : null;
+    const host = (window.__TOOLHOST__ || location.hostname);
+    const url = t.port ? ('http://'+host+':'+t.port+'/') : null;
     const go = url ? `<a class="btn go ${st==='up'?'':'off'}" href="${url}" target="_blank" rel="noopener noreferrer">Launch ↗</a>`
                    : `<span class="btn go off">Local app</span>`;
     return `<div class="card">
@@ -130,6 +131,7 @@ async function loadStatus(){
 
 async function init(){
   const m = await (await fetch('/api/tools')).json();
+  window.__TOOLHOST__ = m.hub.toolHost || '';
   TOOLS = m.tools; $('#sub').textContent = m.hub.subtitle;
   renderPills(m.categories);
   // restore prefs
diff --git a/server.js b/server.js
index 5dd5d4f..4529386 100644
--- a/server.js
+++ b/server.js
@@ -8,7 +8,8 @@ const net = require('net');
 
 const PORT = process.env.PORT || 0;                       // 0 = OS-assigned free port (local dev)
 const BASIC_AUTH = process.env.BASIC_AUTH || 'admin:DW2024!';
-const PROBE_HOST = process.env.PROBE_HOST || '127.0.0.1'; // where the tool apps listen (localhost on Mac2; tailnet/Kamatera-local when public)
+const PROBE_HOST = process.env.PROBE_HOST || '127.0.0.1'; // where the tool apps listen (localhost on Mac2; tailnet IP when public)
+const TOOL_HOST = process.env.TOOL_HOST || '';            // host the UI builds Launch links against ('' = the browser's own hostname)
 const [AUTH_USER, AUTH_PASS] = BASIC_AUTH.split(':');
 const ROOT = __dirname;
 
@@ -52,8 +53,10 @@ const server = http.createServer(async (req, res) => {
   if (!checkAuth(req)) return unauthorized(res);
 
   if (url === '/api/tools') {
+    const m = manifest();
+    m.hub.toolHost = TOOL_HOST;   // '' → UI falls back to the browser's own hostname (local dev)
     res.writeHead(200, { 'Content-Type': 'application/json' });
-    return res.end(JSON.stringify(manifest()));
+    return res.end(JSON.stringify(m));
   }
 
   if (url === '/api/status') {

← cf9e9dc initial scaffold: tools.designerwallcoverings launcher + liv  ·  back to Tools Dw Hub  ·  add SCOPE-tools-public.md: tiered plan for publishing indivi 7e42fdb →