-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Hey ππ»,
I have a question, we are looking to use this module alongside the @octokit/graphql.js.
We work behind a corporate proxy, so we need to be able to pass a proxy to any egress request from within our network.
I see that both this and the @octokit/graphql.js
modules use the @octokit/request.js) module to make its requests to the GitHub API.
By taking a look at your code, you seem to be using node-fetch for actually making the HTTP Requests behind the scenes.
Taking a look at node-fetch it does support passing in an agent. When taking a look at your request library, there doesn't seem to be any options, which I would have expected to see here? (maybe?)
We would love to be able to pass in a httpsAgent
somewhere?
const { createAppAuth } = require("@octokit/auth-app");
const httpAgent = new http.Agent({ keepAlive: true });
const httpsAgent = new https.Agent({ keepAlive: true });
const auth = createAppAuth({
id: 1,
privateKey: "-----BEGIN PRIVATE KEY-----\n...",
installationId: 123,
clientId: "1234567890abcdef1234",
clientSecret: "1234567890abcdef12341234567890abcdef1234"
});
const installationAuthentication = await auth({
type: "installation" ,
agent: url => url.protocol === 'https:' ? httpsAgent : httpAgent
});
const graphqlWithAuth = graphql.defaults({
request: {
hook: auth.hook
agent: url => url.protocol === 'https:' ? httpsAgent : httpAgent
}
});
Something like that? It would be great if we could do this in a single place when looking through the octokit
modules, it would be great to have a single experience across the @octokit
ecosystem π€?
Just wanted to put it here and get some of your thoughts on best practice π
Thanks for all your help.