mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
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:
@@ -89,6 +89,7 @@ dotenv.config();
|
||||
|
||||
const PORT = parseInt(process.env.PORT || '3008', 10);
|
||||
const HOST = process.env.HOST || '0.0.0.0';
|
||||
const HOSTNAME = process.env.HOSTNAME || 'localhost';
|
||||
const DATA_DIR = process.env.DATA_DIR || './data';
|
||||
const ENABLE_REQUEST_LOGGING_DEFAULT = process.env.ENABLE_REQUEST_LOGGING !== 'false'; // Default to true
|
||||
|
||||
@@ -618,16 +619,15 @@ const startServer = (port: number, host: string) => {
|
||||
: 'enabled'
|
||||
: 'disabled';
|
||||
const portStr = port.toString().padEnd(4);
|
||||
const hostDisplay = host === '0.0.0.0' ? 'localhost' : host;
|
||||
logger.info(`
|
||||
╔═══════════════════════════════════════════════════════╗
|
||||
║ Automaker Backend Server ║
|
||||
╠═══════════════════════════════════════════════════════╣
|
||||
║ Listening: ${host}:${port}${' '.repeat(Math.max(0, 34 - host.length - port.toString().length))}║
|
||||
║ HTTP API: http://${hostDisplay}:${portStr} ║
|
||||
║ WebSocket: ws://${hostDisplay}:${portStr}/api/events ║
|
||||
║ Terminal: ws://${hostDisplay}:${portStr}/api/terminal/ws ║
|
||||
║ Health: http://${hostDisplay}:${portStr}/api/health ║
|
||||
║ HTTP API: http://${HOSTNAME}:${portStr} ║
|
||||
║ WebSocket: ws://${HOSTNAME}:${portStr}/api/events ║
|
||||
║ Terminal: ws://${HOSTNAME}:${portStr}/api/terminal/ws ║
|
||||
║ Health: http://${HOSTNAME}:${portStr}/api/health ║
|
||||
║ Terminal: ${terminalStatus.padEnd(37)}║
|
||||
╚═══════════════════════════════════════════════════════╝
|
||||
`);
|
||||
|
||||
Reference in New Issue
Block a user