mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-03-12 01:17:48 +00:00
refactor: rename PORT to SERVER_PORT for clarity
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
# Backend server port (Express API + WebSocket server)
|
||||
#API server
|
||||
PORT=3001
|
||||
SERVER_PORT=3001
|
||||
#Frontend port
|
||||
VITE_PORT=5173
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
npx @siteboon/claude-code-ui
|
||||
```
|
||||
|
||||
サーバーが起動し、`http://localhost:3001`(または設定した PORT)でアクセスできます。
|
||||
サーバーが起動し、`http://localhost:3001`(または設定した SERVER_PORT)でアクセスできます。
|
||||
|
||||
**再起動**: サーバーを停止した後、同じ `npx` コマンドを再度実行するだけです
|
||||
### グローバルインストール(定期的に使用する場合)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
npx @siteboon/claude-code-ui
|
||||
```
|
||||
|
||||
서버가 시작되면 `http://localhost:3001` (또는 설정한 PORT)에서 접근할 수 있습니다.
|
||||
서버가 시작되면 `http://localhost:3001` (또는 설정한 SERVER_PORT)에서 접근할 수 있습니다.
|
||||
|
||||
**재시작**: 서버를 중지한 후 동일한 `npx` 명령을 다시 실행하면 됩니다
|
||||
### 전역 설치 (정기적 사용 시)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
npx @siteboon/claude-code-ui
|
||||
```
|
||||
|
||||
服务器将启动并可通过 `http://localhost:3001`(或您配置的 PORT)访问。
|
||||
服务器将启动并可通过 `http://localhost:3001`(或您配置的 SERVER_PORT)访问。
|
||||
|
||||
**重启**: 停止服务器后只需再次运行相同的 `npx` 命令
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ function showStatus() {
|
||||
|
||||
// Environment variables
|
||||
console.log(`\n${c.info('[INFO]')} Configuration:`);
|
||||
console.log(` PORT: ${c.bright(process.env.PORT || '3001')} ${c.dim(process.env.PORT ? '' : '(default)')}`);
|
||||
console.log(` SERVER_PORT: ${c.bright(process.env.SERVER_PORT || '3001')} ${c.dim(process.env.SERVER_PORT ? '' : '(default)')}`);
|
||||
console.log(` DATABASE_PATH: ${c.dim(process.env.DATABASE_PATH || '(using default location)')}`);
|
||||
console.log(` CLAUDE_CLI_PATH: ${c.dim(process.env.CLAUDE_CLI_PATH || 'claude (default)')}`);
|
||||
console.log(` CONTEXT_WINDOW: ${c.dim(process.env.CONTEXT_WINDOW || '160000 (default)')}`);
|
||||
@@ -134,7 +134,7 @@ function showStatus() {
|
||||
console.log(` ${c.dim('>')} Use ${c.bright('cloudcli --port 8080')} to run on a custom port`);
|
||||
console.log(` ${c.dim('>')} Use ${c.bright('cloudcli --database-path /path/to/db')} for custom database`);
|
||||
console.log(` ${c.dim('>')} Run ${c.bright('cloudcli help')} for all options`);
|
||||
console.log(` ${c.dim('>')} Access the UI at http://localhost:${process.env.PORT || '3001'}\n`);
|
||||
console.log(` ${c.dim('>')} Access the UI at http://localhost:${process.env.SERVER_PORT || '3001'}\n`);
|
||||
}
|
||||
|
||||
// Show help
|
||||
@@ -169,7 +169,7 @@ Examples:
|
||||
$ cloudcli status # Show configuration
|
||||
|
||||
Environment Variables:
|
||||
PORT Set server port (default: 3001)
|
||||
SERVER_PORT Set server port (default: 3001)
|
||||
DATABASE_PATH Set custom database location
|
||||
CLAUDE_CLI_PATH Set custom Claude CLI path
|
||||
CONTEXT_WINDOW Set context window size (default: 160000)
|
||||
@@ -260,9 +260,9 @@ function parseArgs(args) {
|
||||
const arg = args[i];
|
||||
|
||||
if (arg === '--port' || arg === '-p') {
|
||||
parsed.options.port = args[++i];
|
||||
parsed.options.serverPort = args[++i];
|
||||
} else if (arg.startsWith('--port=')) {
|
||||
parsed.options.port = arg.split('=')[1];
|
||||
parsed.options.serverPort = arg.split('=')[1];
|
||||
} else if (arg === '--database-path') {
|
||||
parsed.options.databasePath = args[++i];
|
||||
} else if (arg.startsWith('--database-path=')) {
|
||||
@@ -285,8 +285,8 @@ async function main() {
|
||||
const { command, options } = parseArgs(args);
|
||||
|
||||
// Apply CLI options to environment variables
|
||||
if (options.port) {
|
||||
process.env.PORT = options.port;
|
||||
if (options.serverPort) {
|
||||
process.env.SERVER_PORT = options.serverPort;
|
||||
}
|
||||
if (options.databasePath) {
|
||||
process.env.DATABASE_PATH = options.databasePath;
|
||||
|
||||
@@ -31,7 +31,7 @@ const c = {
|
||||
dim: (text) => `${colors.dim}${text}${colors.reset}`,
|
||||
};
|
||||
|
||||
console.log('PORT from env:', process.env.PORT);
|
||||
console.log('SERVER_PORT from env:', process.env.SERVER_PORT);
|
||||
|
||||
import express from 'express';
|
||||
import { WebSocketServer, WebSocket } from 'ws';
|
||||
@@ -2491,7 +2491,7 @@ async function getFileTree(dirPath, maxDepth = 3, currentDepth = 0, showHidden =
|
||||
});
|
||||
}
|
||||
|
||||
const PORT = process.env.PORT || 3001;
|
||||
const SERVER_PORT = process.env.SERVER_PORT || 3001;
|
||||
const HOST = process.env.HOST || '0.0.0.0';
|
||||
const DISPLAY_HOST = getConnectableHost(HOST);
|
||||
const VITE_PORT = process.env.VITE_PORT || 5173;
|
||||
@@ -2511,12 +2511,12 @@ async function startServer() {
|
||||
console.log('');
|
||||
|
||||
if (isProduction) {
|
||||
console.log(`${c.info('[INFO]')} To run in production mode, go to http://${DISPLAY_HOST}:${PORT}`);
|
||||
console.log(`${c.info('[INFO]')} To run in production mode, go to http://${DISPLAY_HOST}:${SERVER_PORT}`);
|
||||
}
|
||||
|
||||
console.log(`${c.info('[INFO]')} To run in development mode with hot-module replacement, go to http://${DISPLAY_HOST}:${VITE_PORT}`);
|
||||
|
||||
server.listen(PORT, HOST, async () => {
|
||||
server.listen(SERVER_PORT, HOST, async () => {
|
||||
const appInstallPath = path.join(__dirname, '..');
|
||||
|
||||
console.log('');
|
||||
@@ -2524,7 +2524,7 @@ async function startServer() {
|
||||
console.log(` ${c.bright('Claude Code UI Server - Ready')}`);
|
||||
console.log(c.dim('═'.repeat(63)));
|
||||
console.log('');
|
||||
console.log(`${c.info('[INFO]')} Server URL: ${c.bright('http://' + DISPLAY_HOST + ':' + PORT)}`);
|
||||
console.log(`${c.info('[INFO]')} Server URL: ${c.bright('http://' + DISPLAY_HOST + ':' + SERVER_PORT)}`);
|
||||
console.log(`${c.info('[INFO]')} Installed at: ${c.dim(appInstallPath)}`);
|
||||
console.log(`${c.tip('[TIP]')} Run "cloudcli status" for full configuration details`);
|
||||
console.log('');
|
||||
|
||||
@@ -529,7 +529,7 @@ router.get('/next/:projectName', async (req, res) => {
|
||||
|
||||
// Fallback to loading tasks and finding next one locally
|
||||
// Use localhost to bypass proxy for internal server-to-server calls
|
||||
const tasksResponse = await fetch(`http://localhost:${process.env.PORT || 3001}/api/taskmaster/tasks/${encodeURIComponent(projectName)}`, {
|
||||
const tasksResponse = await fetch(`http://localhost:${process.env.SERVER_PORT || 3001}/api/taskmaster/tasks/${encodeURIComponent(projectName)}`, {
|
||||
headers: {
|
||||
'Authorization': req.headers.authorization
|
||||
}
|
||||
@@ -1960,4 +1960,4 @@ Brief description of what this web application will do and why it's needed.
|
||||
];
|
||||
}
|
||||
|
||||
export default router;
|
||||
export default router;
|
||||
|
||||
@@ -9,7 +9,7 @@ export default defineConfig(({ command, mode }) => {
|
||||
const configuredHost = env.HOST || '0.0.0.0'
|
||||
const host = normalizeLoopbackHost(configuredHost)
|
||||
const proxyHost = getConnectableHost(configuredHost)
|
||||
const port = env.PORT || 3001
|
||||
const serverPort = env.SERVER_PORT || 3001
|
||||
|
||||
return {
|
||||
plugins: [react()],
|
||||
@@ -17,13 +17,13 @@ export default defineConfig(({ command, mode }) => {
|
||||
host,
|
||||
port: parseInt(env.VITE_PORT) || 5173,
|
||||
proxy: {
|
||||
'/api': `http://${proxyHost}:${port}`,
|
||||
'/api': `http://${proxyHost}:${serverPort}`,
|
||||
'/ws': {
|
||||
target: `ws://${proxyHost}:${port}`,
|
||||
target: `ws://${proxyHost}:${serverPort}`,
|
||||
ws: true
|
||||
},
|
||||
'/shell': {
|
||||
target: `ws://${proxyHost}:${port}`,
|
||||
target: `ws://${proxyHost}:${serverPort}`,
|
||||
ws: true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user