Skip to content

Commit

Permalink
Add proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
quidl committed Aug 5, 2024
1 parent b1869bf commit 8483212
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ENV KATALON_USERNAME=''
ENV KATALON_API_KEY=''
ENV TEAM_ID=''
ENV PROXY=''
ENV PROXY_EXCLUDED_URLS=''
ENV LOG_LEVEL='INFO'
ENV XVFB_RUN=''
ENV X11_DISPLAY=''
Expand Down
4 changes: 4 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ program
.option('-a, --agent-name <value>', 'Agent name')
.option('-c, --config <value>', 'Configuration file path')
.option('-x, --proxy <value>', 'HTTTP/HTTPS Proxy')
.option('--excluded-urls <value>', 'Proxy excluded URLs')
.option('--log-level <value>', 'Log level (ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < MARK < OFF)')
.option('--xvfb-run <value>', 'xvfb-run options')
.option('--x11-display <value>', 'x11 DISPLAY environment variable')
Expand All @@ -44,6 +45,7 @@ program
agentName: command.agentName,
configPath: command.config,
proxy: command.proxy,
proxyExcludedUrls: command.proxyExcludedUrls,
logLevel: command.logLevel,
xvfbRun: command.xvfbRun,
x11Display: command.x11Display,
Expand All @@ -62,6 +64,7 @@ program
.option('-a, --agent-name <value>', 'Agent name')
.option('-c, --config <value>', 'Configuration file path')
.option('-x, --proxy <value>', 'HTTTP/HTTPS Proxy')
.option('--proxy-excluded-urls <value>', 'Proxy excluded URLs')
.option('--ci', 'CI mode')
.action((command) => {
const options = {
Expand All @@ -72,6 +75,7 @@ program
agentName: command.agentName,
configPath: command.config,
proxy: command.proxy,
proxyExcludedUrls: command.proxyExcludedUrls,
};
if (process.platform === 'win32') {
readline
Expand Down
4 changes: 2 additions & 2 deletions src/core/api/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ axios.interceptors.response.use(
},
);

// const { proxy, excludedUrls } = config;
// const { proxy, proxyExcludedUrls } = config;
// if (proxy) {
// const httpAgent = new HttpProxyAgent(proxy, { rejectUnauthorized: false, keepAlive: true });
// const httpsAgent = new HttpsProxyAgent(proxy, { rejectUnauthorized: false, keepAlive: true });
// axios.interceptors.request.use((config) => {
// const url = config.url;
// const isExcluded = excludedUrls.some((excludedUrl) => wildcard(excludedUrl, url));
// const isExcluded = proxyExcludedUrls.some((excludedUrl) => wildcard(excludedUrl, url));
// if (!isExcluded) {
// // Set the proxy agents for non-excluded URLs
// if (url.startsWith('http://')) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/api/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const agent = new https.Agent({
});

function getProxy(url) {
const { proxy, excludedUrls } = config;
const { proxy, proxyExcludedUrls } = config;
if (!proxy) {
return false;
}
const isExcluded = excludedUrls.some((excludedUrl) => wildcard(excludedUrl, url));
const isExcluded = proxyExcludedUrls.some((excludedUrl) => wildcard(excludedUrl, url));
if (isExcluded) {
return false;
}
Expand Down

0 comments on commit 8483212

Please sign in to comment.