mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 10:15:40 +00:00
feat(cliproxy): set WRITABLE_PATH for log storage in ~/.ccs/cliproxy/
- Add getCliproxyWritablePath() helper function - Set WRITABLE_PATH env var when spawning CLIProxy in both executors - Logs will now be stored in ~/.ccs/cliproxy/logs/ instead of CWD - Enables error log viewer to find logs in predictable location Note: CLIProxyAPI still has hardcoded MaxBackups=0 (unlimited). Log rotation should be addressed in CLIProxyAPI upstream.
This commit is contained in:
1 parent
1ef625ee86
commit
6b9396fbc6
3 files changed
+19
No files matched your search
@@ -24,6 +24,7 @@ import {
|
|||||||
getProviderConfig,
|
getProviderConfig,
|
||||||
ensureProviderSettings,
|
ensureProviderSettings,
|
||||||
CLIPROXY_DEFAULT_PORT,
|
CLIPROXY_DEFAULT_PORT,
|
||||||
|
getCliproxyWritablePath,
|
||||||
} from './config-generator';
|
} from './config-generator';
|
||||||
import { isAuthenticated } from './auth-handler';
|
import { isAuthenticated } from './auth-handler';
|
||||||
import { CLIProxyProvider, ExecutorConfig } from './types';
|
import { CLIProxyProvider, ExecutorConfig } from './types';
|
||||||
@@ -369,6 +370,10 @@ export async function execClaudeWithCLIProxy(
|
|||||||
proxy = spawn(binaryPath, proxyArgs, {
|
proxy = spawn(binaryPath, proxyArgs, {
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
detached: true, // Persist after parent terminal closes
|
detached: true, // Persist after parent terminal closes
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
WRITABLE_PATH: getCliproxyWritablePath(), // Logs stored in ~/.ccs/cliproxy/logs/
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unref so parent process can exit independently
|
// Unref so parent process can exit independently
|
||||||
|
|||||||
@@ -30,6 +30,15 @@ export const CCS_INTERNAL_API_KEY = 'ccs-internal-managed';
|
|||||||
/** Simple secret key for Control Panel login (user-facing) */
|
/** Simple secret key for Control Panel login (user-facing) */
|
||||||
export const CCS_CONTROL_PANEL_SECRET = 'ccs';
|
export const CCS_CONTROL_PANEL_SECRET = 'ccs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get CLIProxy writable directory for logs and runtime files.
|
||||||
|
* This directory is set as WRITABLE_PATH env var when spawning CLIProxy.
|
||||||
|
* Logs will be stored in ~/.ccs/cliproxy/logs/
|
||||||
|
*/
|
||||||
|
export function getCliproxyWritablePath(): string {
|
||||||
|
return path.join(getCcsDir(), 'cliproxy');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config version - bump when config format changes to trigger regeneration
|
* Config version - bump when config format changes to trigger regeneration
|
||||||
* v1: Initial config (port, auth-dir, api-keys only)
|
* v1: Initial config (port, auth-dir, api-keys only)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
regenerateConfig,
|
regenerateConfig,
|
||||||
configNeedsRegeneration,
|
configNeedsRegeneration,
|
||||||
CLIPROXY_DEFAULT_PORT,
|
CLIPROXY_DEFAULT_PORT,
|
||||||
|
getCliproxyWritablePath,
|
||||||
} from './config-generator';
|
} from './config-generator';
|
||||||
import { isCliproxyRunning } from './stats-fetcher';
|
import { isCliproxyRunning } from './stats-fetcher';
|
||||||
|
|
||||||
@@ -171,6 +172,10 @@ export async function ensureCliproxyService(
|
|||||||
proxyProcess = spawn(binaryPath, proxyArgs, {
|
proxyProcess = spawn(binaryPath, proxyArgs, {
|
||||||
stdio: ['ignore', verbose ? 'pipe' : 'ignore', verbose ? 'pipe' : 'ignore'],
|
stdio: ['ignore', verbose ? 'pipe' : 'ignore', verbose ? 'pipe' : 'ignore'],
|
||||||
detached: true, // Allow process to run independently
|
detached: true, // Allow process to run independently
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
WRITABLE_PATH: getCliproxyWritablePath(), // Logs stored in ~/.ccs/cliproxy/logs/
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Forward output in verbose mode
|
// Forward output in verbose mode
|
||||||
|
|||||||
Reference in new issue
Block a user