-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect HTTP_PROXY and HTTPS_PROXY #1081
Comments
@adanilev On second thought, provided @P0lip agrees with the initial idea, I wonder if we shouldn't make the Spectral library unaware of that selection process and those ENV variables. The counter proposal would be to extend the Spectral ctor parameters so that it accepts one optional If a "which better ENV variable should I use to pick as the proxy address" process should exist, it would be move up in the cli and exported for potential reuse. This way:
Thoughts? |
This is a tricky problem, as we do need to keep in mind the browser usage. The second idea @nulltoken proposed sounds OK. |
@adanilev Would you still be open to move this farther? |
@nulltoken, yes, for sure. Will aim to submit something soon, apologies for the slowness. I'll work on your second option - passing a proxy param to the Spectral constructor. |
User story.
As a user running behind a corporate proxy, I can use Spectral from JS, so that I can reap its benefits.
Is your feature request related to a problem?
Spectral doesn't work behind a corporate proxy if you're not using the CLI.
Describe the solution you'd like
Spectral should try to use a proxy when it is instantiated from code as documented here and not only when it's called via CLI.
AFAIK, HTTPS_PROXY, HTTP_PROXY and their lowercase cousins are standard environment variables for setting proxies. Many people will already have them set if they are using a proxy. In order, Spectral should try to use:
Additional context
I'm calling Spectral within a TS project and calls to loadRuleset were taking > 2 minutes because requests to http://json-schema.org were timing out when I extended the
spectral:oas
ruleset.Happy to try my hand at a PR if you agree with the proposed solution?
The text was updated successfully, but these errors were encountered: