Fix proxy handling in WAStartupService preventing instance to be created

This commit is contained in:
Judson Junior 2024-01-21 13:01:35 -03:00
parent 1e9b3a1e42
commit 82e111f1be

View File

@ -1384,6 +1384,7 @@ export class WAStartupService {
this.logger.info('Proxy enabled: ' + this.localProxy.proxy);
if (this.localProxy.proxy.host.includes('proxyscrape')) {
try {
const response = await axios.get(this.localProxy.proxy.host);
const text = response.data;
const proxyUrls = text.split('\r\n');
@ -1392,6 +1393,9 @@ export class WAStartupService {
options = {
agent: new ProxyAgent(proxyUrl as any),
};
} catch (error) {
this.localProxy.enabled = false;
}
} else {
let proxyUri =
this.localProxy.proxy.protocol + '://' + this.localProxy.proxy.host + ':' + this.localProxy.proxy.port;