mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
Merge pull request #537 from AutoMaker-Org/claude/issue-536-20260117-0132
feat: add configurable host binding for server and Vite dev server
This commit is contained in:
@@ -166,6 +166,7 @@ Use `resolveModelString()` from `@automaker/model-resolver` to convert model ali
|
|||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
- `ANTHROPIC_API_KEY` - Anthropic API key (or use Claude Code CLI auth)
|
- `ANTHROPIC_API_KEY` - Anthropic API key (or use Claude Code CLI auth)
|
||||||
|
- `HOST` - Host to bind server to (default: 0.0.0.0)
|
||||||
- `PORT` - Server port (default: 3008)
|
- `PORT` - Server port (default: 3008)
|
||||||
- `DATA_DIR` - Data storage directory (default: ./data)
|
- `DATA_DIR` - Data storage directory (default: ./data)
|
||||||
- `ALLOWED_ROOT_DIRECTORY` - Restrict file operations to specific directory
|
- `ALLOWED_ROOT_DIRECTORY` - Restrict file operations to specific directory
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ CORS_ORIGIN=http://localhost:3007
|
|||||||
# OPTIONAL - Server
|
# OPTIONAL - Server
|
||||||
# ============================================
|
# ============================================
|
||||||
|
|
||||||
|
# Host to bind the server to (default: 0.0.0.0)
|
||||||
|
# Use 0.0.0.0 to listen on all interfaces (recommended for Docker/remote access)
|
||||||
|
# Use 127.0.0.1 or localhost to restrict to local connections only
|
||||||
|
HOST=0.0.0.0
|
||||||
|
|
||||||
# Port to run the server on
|
# Port to run the server on
|
||||||
PORT=3008
|
PORT=3008
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ import { getEventHistoryService } from './services/event-history-service.js';
|
|||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
const PORT = parseInt(process.env.PORT || '3008', 10);
|
const PORT = parseInt(process.env.PORT || '3008', 10);
|
||||||
|
const HOST = process.env.HOST || '0.0.0.0';
|
||||||
const DATA_DIR = process.env.DATA_DIR || './data';
|
const DATA_DIR = process.env.DATA_DIR || './data';
|
||||||
const ENABLE_REQUEST_LOGGING_DEFAULT = process.env.ENABLE_REQUEST_LOGGING !== 'false'; // Default to true
|
const ENABLE_REQUEST_LOGGING_DEFAULT = process.env.ENABLE_REQUEST_LOGGING !== 'false'; // Default to true
|
||||||
|
|
||||||
@@ -609,22 +610,24 @@ terminalWss.on('connection', (ws: WebSocket, req: import('http').IncomingMessage
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Start server with error handling for port conflicts
|
// Start server with error handling for port conflicts
|
||||||
const startServer = (port: number) => {
|
const startServer = (port: number, host: string) => {
|
||||||
server.listen(port, () => {
|
server.listen(port, host, () => {
|
||||||
const terminalStatus = isTerminalEnabled()
|
const terminalStatus = isTerminalEnabled()
|
||||||
? isTerminalPasswordRequired()
|
? isTerminalPasswordRequired()
|
||||||
? 'enabled (password protected)'
|
? 'enabled (password protected)'
|
||||||
: 'enabled'
|
: 'enabled'
|
||||||
: 'disabled';
|
: 'disabled';
|
||||||
const portStr = port.toString().padEnd(4);
|
const portStr = port.toString().padEnd(4);
|
||||||
|
const hostDisplay = host === '0.0.0.0' ? 'localhost' : host;
|
||||||
logger.info(`
|
logger.info(`
|
||||||
╔═══════════════════════════════════════════════════════╗
|
╔═══════════════════════════════════════════════════════╗
|
||||||
║ Automaker Backend Server ║
|
║ Automaker Backend Server ║
|
||||||
╠═══════════════════════════════════════════════════════╣
|
╠═══════════════════════════════════════════════════════╣
|
||||||
║ HTTP API: http://localhost:${portStr} ║
|
║ Listening: ${host}:${port}${' '.repeat(Math.max(0, 34 - host.length - port.toString().length))}║
|
||||||
║ WebSocket: ws://localhost:${portStr}/api/events ║
|
║ HTTP API: http://${hostDisplay}:${portStr} ║
|
||||||
║ Terminal: ws://localhost:${portStr}/api/terminal/ws ║
|
║ WebSocket: ws://${hostDisplay}:${portStr}/api/events ║
|
||||||
║ Health: http://localhost:${portStr}/api/health ║
|
║ Terminal: ws://${hostDisplay}:${portStr}/api/terminal/ws ║
|
||||||
|
║ Health: http://${hostDisplay}:${portStr}/api/health ║
|
||||||
║ Terminal: ${terminalStatus.padEnd(37)}║
|
║ Terminal: ${terminalStatus.padEnd(37)}║
|
||||||
╚═══════════════════════════════════════════════════════╝
|
╚═══════════════════════════════════════════════════════╝
|
||||||
`);
|
`);
|
||||||
@@ -658,7 +661,7 @@ const startServer = (port: number) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
startServer(PORT);
|
startServer(PORT, HOST);
|
||||||
|
|
||||||
// Global error handlers to prevent crashes from uncaught errors
|
// Global error handlers to prevent crashes from uncaught errors
|
||||||
process.on('unhandledRejection', (reason: unknown, _promise: Promise<unknown>) => {
|
process.on('unhandledRejection', (reason: unknown, _promise: Promise<unknown>) => {
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ export default defineConfig(({ command }) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
|
host: process.env.HOST || '0.0.0.0',
|
||||||
port: parseInt(process.env.TEST_PORT || '3007', 10),
|
port: parseInt(process.env.TEST_PORT || '3007', 10),
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
|||||||
16
package-lock.json
generated
16
package-lock.json
generated
@@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"apps/server": {
|
"apps/server": {
|
||||||
"name": "@automaker/server",
|
"name": "@automaker/server",
|
||||||
"version": "0.10.0",
|
"version": "0.11.0",
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/claude-agent-sdk": "0.1.76",
|
"@anthropic-ai/claude-agent-sdk": "0.1.76",
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
},
|
},
|
||||||
"apps/ui": {
|
"apps/ui": {
|
||||||
"name": "@automaker/ui",
|
"name": "@automaker/ui",
|
||||||
"version": "0.10.0",
|
"version": "0.11.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -8956,9 +8956,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/diff": {
|
"node_modules/diff": {
|
||||||
"version": "8.0.2",
|
"version": "8.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/diff/-/diff-8.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz",
|
||||||
"integrity": "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg==",
|
"integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -10811,9 +10811,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/hono": {
|
"node_modules/hono": {
|
||||||
"version": "4.11.3",
|
"version": "4.11.4",
|
||||||
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.3.tgz",
|
"resolved": "https://registry.npmjs.org/hono/-/hono-4.11.4.tgz",
|
||||||
"integrity": "sha512-PmQi306+M/ct/m5s66Hrg+adPnkD5jiO6IjA7WhWw0gSBSo1EcRegwuI1deZ+wd5pzCGynCcn2DprnE4/yEV4w==",
|
"integrity": "sha512-U7tt8JsyrxSRKspfhtLET79pU8K+tInj5QZXs1jSugO1Vq5dFj3kmZsRldo29mTBfcjDRVRXrEZ6LS63Cog9ZA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
Reference in New Issue
Block a user