mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
feat: add support for https_proxy env var
This commit is contained in:
parent
01f7dd1d28
commit
28beef91aa
4 changed files with 1766 additions and 8 deletions
|
@ -1,7 +1,23 @@
|
|||
import {Octokit as Core} from '@octokit/core'
|
||||
import {paginateRest} from '@octokit/plugin-paginate-rest'
|
||||
import {restEndpointMethods} from '@octokit/plugin-rest-endpoint-methods'
|
||||
import {HttpsProxyAgent} from 'https-proxy-agent'
|
||||
export {RestEndpointMethodTypes} from '@octokit/plugin-rest-endpoint-methods'
|
||||
export {OctokitOptions} from '@octokit/core/dist-types/types'
|
||||
|
||||
export const Octokit = Core.plugin(paginateRest, restEndpointMethods)
|
||||
export const Octokit = Core.plugin(
|
||||
paginateRest,
|
||||
restEndpointMethods,
|
||||
autoProxyAgent
|
||||
)
|
||||
|
||||
// Octokit plugin to support the https_proxy environment variable
|
||||
function autoProxyAgent(octokit: Core) {
|
||||
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY
|
||||
if (!proxy) return
|
||||
|
||||
const agent = new HttpsProxyAgent(proxy)
|
||||
octokit.hook.before('request', options => {
|
||||
options.request.agent = agent
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue