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

@@ -157,7 +157,9 @@ const getServerUrl = (): string => {
const envUrl = import.meta.env.VITE_SERVER_URL;
if (envUrl) return envUrl;
}
return 'http://localhost:3008';
// Use VITE_HOSTNAME if set, otherwise default to localhost
const hostname = import.meta.env.VITE_HOSTNAME || 'localhost';
return `http://${hostname}:3008`;
};
/**
@@ -557,6 +559,7 @@ export interface DevServerLogsResponse {
result?: {
worktreePath: string;
port: number;
url: string;
logs: string;
startedAt: string;
};