fix: handle empty EMEX proxy env vars with proper defaults
Some checks failed
CI / Lint, Typecheck, Test & Build (push) Has been cancelled

ConfigService returns empty string (not the default) when env var
exists but is empty. Add || fallbacks in code and set proper defaults
in docker-compose to prevent invalid proxy URL like http://user:pass@:10000.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 12:21:26 +00:00
parent 0fce6a2266
commit 1a552ed8fd
2 changed files with 10 additions and 10 deletions

View File

@@ -122,10 +122,10 @@ export class EmexService {
// Proxy config — same env vars as emex.browser.ts
const useProxy = this.configService.get<string>('EMEX_USE_PROXY', 'false') === 'true';
if (useProxy) {
const host = this.configService.get<string>('EMEX_PROXY_HOST', '74.81.81.81');
const port = this.configService.get<number>('EMEX_PROXY_PORT_START', 10000);
const user = this.configService.get<string>('EMEX_PROXY_USER', '1726bbe361918676d44e');
const pass = this.configService.get<string>('EMEX_PROXY_PASS', 'f11c7b6128cc86c6');
const host = this.configService.get<string>('EMEX_PROXY_HOST', '') || '74.81.81.81';
const port = this.configService.get<number>('EMEX_PROXY_PORT_START', 10000) || 10000;
const user = this.configService.get<string>('EMEX_PROXY_USER', '') || '1726bbe361918676d44e';
const pass = this.configService.get<string>('EMEX_PROXY_PASS', '') || 'f11c7b6128cc86c6';
this.proxyUrl = `http://${user}:${pass}@${host}:${port}`;
this.logger.log(`EMEX HTTP proxy enabled: ${host}:${port}`);
} else {