Skip to content

Commit 4a8122b

Browse files
committed
add optional proxy config property
This is passed through to axios to allow the full range of proxy config and override capability. By default axios looks at environment variables http_proxy and https_proxy to determine if proxy should be used. If these are not set then it will default off. To force axios to not use the env variables, use `proxy: false` To force different proxy values (overriding env variables) provide an object compatible with axios like ```js proxy: { host: '127.0.0.1', port: 9000, auth: { username: 'mikeymike', password: 'rapunz3l' } } ``` See https://github.com/axios/axios#config-defaults for full details about what is allowed by axios.
1 parent 68f4733 commit 4a8122b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ var opts = {
174174
/* strings or binaries */
175175
],
176176
passphrase: 'yourpassphrase',
177+
proxy: false /* OR proxy config as defined in axios.
178+
If not set axios detects proxy from env vars http_proxy and https_proxy
179+
https://github.com/axios/axios#config-defaults
180+
{
181+
host: '127.0.0.1',
182+
port: 9000,
183+
auth: {
184+
username: 'mikeymike',
185+
password: 'rapunz3l'
186+
}
187+
} */,
177188
auth: {
178189
user: 'theuser', // or username
179190
pass: 'thepassword', // or password

lib/wait-on.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ const WAIT_ON_SCHEMA = Joi.object({
4343
cert: [Joi.string(), Joi.binary()],
4444
key: [Joi.string(), Joi.binary(), Joi.object()],
4545
passphrase: Joi.string(),
46+
proxy: [Joi.boolean(), Joi.object()],
4647
auth: Joi.object({
4748
username: Joi.string(),
4849
password: Joi.string(),
4950
}),
5051
strictSSL: Joi.boolean().default(false),
51-
ignoreProxy: Joi.boolean().default(false),
5252
followRedirect: Joi.boolean().default(true), // HTTP 3XX responses
5353
headers: Joi.object(),
5454
});
@@ -265,10 +265,10 @@ function createHTTP$({ validatedOpts, output }, resource) {
265265
followRedirect,
266266
httpTimeout: timeout,
267267
interval,
268+
proxy,
268269
reverse,
269270
simultaneous,
270271
strictSSL: rejectUnauthorized,
271-
ignoreProxy,
272272
} = validatedOpts;
273273
const method = HTTP_GET_RE.test(resource) ? 'get' : 'head';
274274
const url = resource.replace('-get:', ':');
@@ -284,9 +284,9 @@ function createHTTP$({ validatedOpts, output }, resource) {
284284
...pick(['ca', 'cert', 'key', 'passphrase'], validatedOpts),
285285
}),
286286
...(followRedirect ? {} : { maxRedirects: 0 }), // defaults to 5 (enabled)
287+
...(proxy && { proxy }),
287288
...(timeout && { timeout }),
288289
...urlSocketOptions,
289-
...(ignoreProxy ? { proxy: false }: {}), // axios no proxy
290290
method,
291291
// by default it provides full response object
292292
// validStatus is 2xx unless followRedirect is true (default)

0 commit comments

Comments
 (0)