feat(config): add proxy section to unified config loader

- merge proxy config with defaults in loadUnifiedConfig

- preserve user overrides for remote/fallback/local sections
This commit is contained in:
kaitranntt
2025-12-19 01:11:49 -05:00
parent eff2e2d29f
commit 197174441f
+19
View File
@@ -16,6 +16,7 @@ import {
UNIFIED_CONFIG_VERSION,
DEFAULT_COPILOT_CONFIG,
DEFAULT_GLOBAL_ENV,
DEFAULT_PROXY_CONFIG,
GlobalEnvConfig,
} from './unified-config-types';
import { isUnifiedConfigEnabled } from './feature-flags';
@@ -177,6 +178,24 @@ function mergeWithDefaults(partial: Partial<UnifiedConfig>): UnifiedConfig {
enabled: partial.global_env?.enabled ?? true,
env: partial.global_env?.env ?? { ...DEFAULT_GLOBAL_ENV },
},
// Proxy config - remote/local CLIProxyAPI settings
proxy: {
remote: {
enabled: partial.proxy?.remote?.enabled ?? DEFAULT_PROXY_CONFIG.remote.enabled,
host: partial.proxy?.remote?.host ?? DEFAULT_PROXY_CONFIG.remote.host,
port: partial.proxy?.remote?.port ?? DEFAULT_PROXY_CONFIG.remote.port,
protocol: partial.proxy?.remote?.protocol ?? DEFAULT_PROXY_CONFIG.remote.protocol,
auth_token: partial.proxy?.remote?.auth_token ?? DEFAULT_PROXY_CONFIG.remote.auth_token,
},
fallback: {
enabled: partial.proxy?.fallback?.enabled ?? DEFAULT_PROXY_CONFIG.fallback.enabled,
auto_start: partial.proxy?.fallback?.auto_start ?? DEFAULT_PROXY_CONFIG.fallback.auto_start,
},
local: {
port: partial.proxy?.local?.port ?? DEFAULT_PROXY_CONFIG.local.port,
auto_start: partial.proxy?.local?.auto_start ?? DEFAULT_PROXY_CONFIG.local.auto_start,
},
},
};
}