Proxy support is broken
=======================
**Describe the bug**
Proxy support was introduced in #1215, but it is currently broken.
**To Reproduce**
Steps to reproduce the behavior:
1. Somehow make api.netlify.com unavailable, e.g. by being on a closed network where a proxy is required. For reproduction purposes, one can force this by modifying `/etc/hosts` and pointing api.netlify.com to a local container / VM where we spin up a trivial HTTP server that simply stalls on any incoming request.
2. Have a proxy server set up, e.g. mitmproxy or Charles.
3. Run any command through a proxy, e.g. `HTTP_PROXY=http://localhost:8888 netlify login`.
At this point `netlify-cli` would simply stall, and if you monitor the proxy server you'll notice that no request is going through it.
**Configuration**
N/A.
**Expected behavior**
Any network request originating from netlify-cli should be proxied.
**CLI Output**
N/A.
**Additional context**
This happens because `getConfig` happens before the proxy is even configured (with `getAgent`)
https://github.com/netlify/cli/blob/7a55e9871059ac656096735d1c0369b4d473e07e/src/utils/command.js#L46-L57
`getConfig` calls `resolveConfig` which is `@netlify/config`.
https://github.com/netlify/cli/blob/7a55e9871059ac656096735d1c0369b4d473e07e/src/utils/command.js#L4
Looking at `@netlify/config`'s `resolveConfig`: https://github.com/netlify/build/blob/6813d73a21a6c4a6b99576c5b7bc60fae5d8bac4/packages/config/src/main.js#L32-L36 we see that there are API requests made at this stage unless `offline` is true. These requests obviously aren't going through the proxy.
I guess to actually fully support proxies you need to add proxy support to `@netlify/config` as well.
---
Knowing the cause of the issue, here's a risky workaround btw: just set `offline` to true in `src/utils/command.js`:
```diff
- const cachedConfig = await this.getConfig({ cwd, state, token, ...apiUrlOpts })
+ const cachedConfig = await this.getConfig({ cwd, state, token, offline: true, ...apiUrlOpts })
```
One can hot edit this directly into `node_modules/netlify-cli/src/utils/command.js`. (Don't complain to me if anything breaks, obviously.)
---
Related: I believe #2016 is exactly this problem.