mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-05 12:16:46 +00:00
fix(glmt): pass env vars to proxy subprocess
The spawn() call was missing the env option, so ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL were not being passed to the proxy subprocess. This caused 401 Unauthorized errors.
This commit is contained in:
@@ -75,8 +75,14 @@ async function execClaudeWithProxy(
|
|||||||
const proxyPath = path.join(__dirname, 'glmt', 'glmt-proxy.js');
|
const proxyPath = path.join(__dirname, 'glmt', 'glmt-proxy.js');
|
||||||
const proxyArgs = verbose ? ['--verbose'] : [];
|
const proxyArgs = verbose ? ['--verbose'] : [];
|
||||||
// Use process.execPath for Windows compatibility (CVE-2024-27980)
|
// Use process.execPath for Windows compatibility (CVE-2024-27980)
|
||||||
|
// Pass environment variables to proxy subprocess (required for auth)
|
||||||
const proxy = spawn(process.execPath, [proxyPath, ...proxyArgs], {
|
const proxy = spawn(process.execPath, [proxyPath, ...proxyArgs], {
|
||||||
stdio: ['ignore', 'pipe', verbose ? 'pipe' : 'inherit'],
|
stdio: ['ignore', 'pipe', verbose ? 'pipe' : 'inherit'],
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
ANTHROPIC_AUTH_TOKEN: apiKey,
|
||||||
|
ANTHROPIC_BASE_URL: settings.env.ANTHROPIC_BASE_URL,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3. Wait for proxy ready signal (with timeout)
|
// 3. Wait for proxy ready signal (with timeout)
|
||||||
|
|||||||
Reference in New Issue
Block a user