chore(): route tests via proxy instead of github CI address
This commit is contained in:
25
test/proxy.util.ts
Normal file
25
test/proxy.util.ts
Normal 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,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user