feat: add HOSTNAME and VITE_HOSTNAME support for improved server URL configuration

- Introduced `HOSTNAME` environment variable for user-facing URLs, defaulting to localhost.
- Updated server and client code to utilize `HOSTNAME` for constructing URLs instead of hardcoded localhost.
- Enhanced documentation in CLAUDE.md to reflect new configuration options.
- Added `VITE_HOSTNAME` for frontend API URLs, ensuring consistent hostname usage across the application.

These changes improve flexibility in server configuration and enhance the user experience by providing accurate URLs.
This commit is contained in:
webdevcody
2026-01-16 22:40:36 -05:00
parent d98cae124f
commit 616e2ef75f
7 changed files with 19 additions and 9 deletions

View File

@@ -379,10 +379,11 @@ class DevServerService {
// Create server info early so we can reference it in handlers
// We'll add it to runningServers after verifying the process started successfully
const hostname = process.env.HOSTNAME || 'localhost';
const serverInfo: DevServerInfo = {
worktreePath,
port,
url: `http://localhost:${port}`,
url: `http://${hostname}:${port}`,
process: devProcess,
startedAt: new Date(),
scrollbackBuffer: '',
@@ -474,7 +475,7 @@ class DevServerService {
result: {
worktreePath,
port,
url: `http://localhost:${port}`,
url: `http://${hostname}:${port}`,
message: `Dev server started on port ${port}`,
},
};
@@ -594,6 +595,7 @@ class DevServerService {
result?: {
worktreePath: string;
port: number;
url: string;
logs: string;
startedAt: string;
};
@@ -613,6 +615,7 @@ class DevServerService {
result: {
worktreePath: server.worktreePath,
port: server.port,
url: server.url,
logs: server.scrollbackBuffer,
startedAt: server.startedAt.toISOString(),
},