From c183fe42e9bbcbe43ea434bfd6da30ccc606b731 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath <2+defunkt@users.noreply.github.com> Date: Wed, 11 Feb 2026 16:09:14 -0800 Subject: [PATCH] set TOES_URL --- src/server/apps.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/apps.ts b/src/server/apps.ts index 1c31fc6..b8096ee 100644 --- a/src/server/apps.ts +++ b/src/server/apps.ts @@ -2,6 +2,7 @@ import type { App as SharedApp, AppState } from '@types' import type { Subprocess } from 'bun' import { DEFAULT_EMOJI } from '@types' import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, symlinkSync, unlinkSync, writeFileSync } from 'fs' +import { hostname } from 'os' import { join, resolve } from 'path' import { loadAppEnv } from '../tools/env' import { appLog, hostLog, setApps } from './tui' @@ -10,7 +11,9 @@ export type { AppState } from '@types' export const APPS_DIR = process.env.APPS_DIR ?? resolve(join(process.env.DATA_DIR ?? '.', 'apps')) export const TOES_DIR = process.env.TOES_DIR ?? join(process.env.DATA_DIR ?? '.', 'toes') -export const TOES_URL = process.env.TOES_URL ?? `http://localhost:${process.env.PORT || 3000}` + +const defaultHost = process.env.NODE_ENV === 'production' ? `${hostname()}.local` : 'localhost' +export const TOES_URL = process.env.TOES_URL ?? `http://${defaultHost}:${process.env.PORT || 3000}` const HEALTH_CHECK_FAILURES_BEFORE_RESTART = 3 const HEALTH_CHECK_INTERVAL = 30000