Skip to content

Commit d46974f

Browse files
Benedikt Rötschaxe312ger
authored andcommitted
feat(proxy): add new raw proxy config option
1 parent 86e4835 commit d46974f

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ The Management API host
123123
#### `proxy` [string]
124124
Proxy configuration in HTTP auth format: `host:port` or `user:password@host:port`
125125

126+
#### `rawProxy` [boolean]
127+
Pass proxy config to Axios instead of creating a custom httpsAgent
128+
126129
### Other
127130

128131
#### `errorLogFile` [string]
@@ -131,6 +134,18 @@ Full path to the error log file
131134
#### `useVerboseRenderer` [boolean] [default: false]
132135
Display progress in new lines instead of displaying a busy spinner and the status in the same line. Useful for CI.
133136

137+
## :rescue_worker_helmet: Troubleshooting
138+
139+
* Unable to connect to Contentful through your Proxy? Try to set the `rawProxy` option to `true`.
140+
141+
```javascript
142+
contentfulImport({
143+
proxy: 'https://cat:dog@example.com:1234',
144+
rawProxy: true,
145+
...
146+
})
147+
```
148+
134149
## :card_file_box: Expected input data structure
135150

136151
The data to import should be structured like this:

lib/parseOptions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ export default function parseOptions (params) {
2222
skipContentPublishing: false,
2323
useVerboseRenderer: false,
2424
prePublishDelay: 3000,
25-
environmentId: 'master'
25+
environmentId: 'master',
26+
rawProxy: false
2627
}
2728

2829
const configFile = params.config
@@ -89,7 +90,7 @@ export default function parseOptions (params) {
8990
options.proxy = proxyStringToObject(options.proxy)
9091
}
9192

92-
if (options.proxy) {
93+
if (!options.rawProxy && options.proxy) {
9394
options.httpsAgent = agentFromProxy(options.proxy)
9495
delete options.proxy
9596
}

lib/usageParams.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,10 @@ export default yargs
6363
describe: 'Proxy configuration in HTTP auth format: [http|https]://host:port or [http|https]://user:password@host:port',
6464
type: 'string'
6565
})
66+
.option('raw-proxy', {
67+
describe: 'Pass proxy config to Axios instead of creating a custom httpsAgent',
68+
type: 'boolean',
69+
default: false
70+
})
6671
.config('config', 'An optional configuration JSON file containing all the options for a single run')
6772
.argv

0 commit comments

Comments
 (0)