chore(): route tests via proxy instead of github CI address

This commit is contained in:
tiagosiebler
2023-08-18 16:21:13 +01:00
parent 9bc1ff89c6
commit 21ac313f38
37 changed files with 581 additions and 415 deletions

25
test/proxy.util.ts Normal file
View File

@@ -0,0 +1,25 @@
import { AxiosRequestConfig } from 'axios';
export function getTestProxy(): AxiosRequestConfig {
if (process.env.PROXY_ENABLED !== 'true') {
return {};
}
const host = process.env.PROXY_HOST;
const port = process.env.PROXY_PORT;
const user = process.env.PROXY_USER;
const pass = process.env.PROXY_PASS;
if (!host || !port || !user || !pass) {
throw new Error('One or more env vars missing for proxy support');
}
return {
proxy: {
host,
port: Number(port),
auth: {
username: user,
password: pass,
},
},
};
}