Skip to content

Commit

Permalink
Add a baseurl option that allows you to specify an API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Apr 4, 2019
1 parent 8763706 commit ef2810e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import pkg from '../package.json';
program
.version(pkg.version)
.usage('<command> [<args>]')
.option('--baseurl <baseurl>', 'API endpoint', 'https://api.github.com')
.option('-T, --token <token>', 'OAuth2 token')
.option('-o, --owner <owner>', 'owner')
.option('-r, --repo <repo>', 'repo')
Expand All @@ -36,13 +37,10 @@ program.parse(process.argv);

const [command, ...args] = program.args;

const token = (program.token || process.env.GITHUB_TOKEN);
const octokit = new Octokit({
auth() {
const token = (program.token || process.env.GITHUB_TOKEN);
if (token) {
return `token ${token}`;
}
}
auth: token || null,
baseUrl: program.baseurl,
});

function next(response) {
Expand Down

0 comments on commit ef2810e

Please sign in to comment.