mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 08:15:17 +00:00
refactor(commands): share cliproxy default port for setup and help
- source setup wizard local port default from port-manager - render help text defaults from shared constant
This commit is contained in:
1 parent
90b8d04d71
commit
688f3e3889
2 files changed
+6
-4
No files matched your search
@@ -3,6 +3,7 @@ import * as path from 'path';
|
|||||||
import { initUI, box, color, dim, sectionHeader, subheader } from '../utils/ui';
|
import { initUI, box, color, dim, sectionHeader, subheader } from '../utils/ui';
|
||||||
import { isUnifiedMode } from '../config/unified-config-loader';
|
import { isUnifiedMode } from '../config/unified-config-loader';
|
||||||
import { getCcsDir, getCcsDirSource } from '../utils/config-manager';
|
import { getCcsDir, getCcsDirSource } from '../utils/config-manager';
|
||||||
|
import { CLIPROXY_DEFAULT_PORT } from '../cliproxy/config/port-manager';
|
||||||
|
|
||||||
// Get version from package.json (same as version-command.ts)
|
// Get version from package.json (same as version-command.ts)
|
||||||
const VERSION = JSON.parse(
|
const VERSION = JSON.parse(
|
||||||
@@ -345,7 +346,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
|
|||||||
// CLI Proxy configuration flags (new)
|
// CLI Proxy configuration flags (new)
|
||||||
printSubSection('CLI Proxy Configuration', [
|
printSubSection('CLI Proxy Configuration', [
|
||||||
['--proxy-host <host>', 'Remote proxy hostname/IP'],
|
['--proxy-host <host>', 'Remote proxy hostname/IP'],
|
||||||
['--proxy-port <port>', 'Proxy port (default: 8317)'],
|
['--proxy-port <port>', `Proxy port (default: ${CLIPROXY_DEFAULT_PORT})`],
|
||||||
['--proxy-protocol <proto>', 'Protocol: http or https (default: http)'],
|
['--proxy-protocol <proto>', 'Protocol: http or https (default: http)'],
|
||||||
['--proxy-auth-token <token>', 'Auth token for remote proxy'],
|
['--proxy-auth-token <token>', 'Auth token for remote proxy'],
|
||||||
['--proxy-timeout <ms>', 'Connection timeout in ms (default: 2000)'],
|
['--proxy-timeout <ms>', 'Connection timeout in ms (default: 2000)'],
|
||||||
@@ -421,7 +422,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
|
|||||||
console.log(` Binary: ${color(`${dirDisplay}/cliproxy/bin/cli-proxy-api-plus`, 'path')}`);
|
console.log(` Binary: ${color(`${dirDisplay}/cliproxy/bin/cli-proxy-api-plus`, 'path')}`);
|
||||||
console.log(` Config: ${color(`${dirDisplay}/cliproxy/config.yaml`, 'path')}`);
|
console.log(` Config: ${color(`${dirDisplay}/cliproxy/config.yaml`, 'path')}`);
|
||||||
console.log(` Auth: ${color(`${dirDisplay}/cliproxy/auth/`, 'path')}`);
|
console.log(` Auth: ${color(`${dirDisplay}/cliproxy/auth/`, 'path')}`);
|
||||||
console.log(` ${dim('Port: 8317 (default)')}`);
|
console.log(` ${dim(`Port: ${CLIPROXY_DEFAULT_PORT} (default)`)}`);
|
||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
// Shared Data
|
// Shared Data
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
} from '../config/unified-config-loader';
|
} from '../config/unified-config-loader';
|
||||||
import { DEFAULT_CLIPROXY_SERVER_CONFIG } from '../config/unified-config-types';
|
import { DEFAULT_CLIPROXY_SERVER_CONFIG } from '../config/unified-config-types';
|
||||||
import { getCcsDir } from '../utils/config-manager';
|
import { getCcsDir } from '../utils/config-manager';
|
||||||
|
import { CLIPROXY_DEFAULT_PORT } from '../cliproxy/config/port-manager';
|
||||||
|
|
||||||
/** Custom error for user cancellation (Ctrl+C) */
|
/** Custom error for user cancellation (Ctrl+C) */
|
||||||
class UserCancelledError extends Error {
|
class UserCancelledError extends Error {
|
||||||
@@ -318,7 +319,7 @@ async function runSetupWizard(force: boolean = false): Promise<void> {
|
|||||||
auto_start: false,
|
auto_start: false,
|
||||||
},
|
},
|
||||||
local: {
|
local: {
|
||||||
port: 8317,
|
port: CLIPROXY_DEFAULT_PORT,
|
||||||
auto_start: false, // Disable local auto-start when using remote
|
auto_start: false, // Disable local auto-start when using remote
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -341,7 +342,7 @@ async function runSetupWizard(force: boolean = false): Promise<void> {
|
|||||||
auth_token: '',
|
auth_token: '',
|
||||||
},
|
},
|
||||||
local: {
|
local: {
|
||||||
port: 8317,
|
port: CLIPROXY_DEFAULT_PORT,
|
||||||
auto_start: true,
|
auto_start: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user