forked from mirrors/probot
Look for private-key.pem
This commit is contained in:
parent
2b8aaf7384
commit
f39c2f6259
|
@ -9,14 +9,26 @@ program
|
||||||
.option('-i, --integration <id>', 'ID of the GitHub Integration', process.env.INTEGRATION_ID)
|
.option('-i, --integration <id>', 'ID of the GitHub Integration', process.env.INTEGRATION_ID)
|
||||||
.option('-s, --secret <secret>', 'Webhook secret of the GitHub Integration', process.env.WEBHOOK_SECRET || 'development')
|
.option('-s, --secret <secret>', 'Webhook secret of the GitHub Integration', process.env.WEBHOOK_SECRET || 'development')
|
||||||
.option('-p, --port <n>', 'Port to start the server on', process.env.PORT || 3000)
|
.option('-p, --port <n>', 'Port to start the server on', process.env.PORT || 3000)
|
||||||
.option('-c, --cert <file>', 'Path to certificate of the GitHub Integration', readCert, process.env.CERT || process.env.PRIVATE_KEY)
|
.option('-c, --cert <file>', 'Path to certificate of the GitHub Integration', path => {
|
||||||
|
try {
|
||||||
|
return require('fs').readFileSync(path);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(err.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}, process.env.CERT || process.env.PRIVATE_KEY)
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
||||||
function readCert(path) {
|
if(!program.integration) {
|
||||||
|
console.warn("Missing GitHub Integration ID.\nUse --integration flag or set INTEGRATION_ID environment variable.");
|
||||||
|
program.help();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!program.cert) {
|
||||||
try {
|
try {
|
||||||
return require('fs').readFileSync(path);
|
program.cert = require('fs').readFileSync('private-key.pem');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(err.message);
|
console.warn("Missing GitHub Integration certificate.\nUse --cert flag or set CERT environment variable.");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,16 +37,6 @@ const pkgConf = require('pkg-conf');
|
||||||
const resolve = require('resolve').sync;
|
const resolve = require('resolve').sync;
|
||||||
const createProbot = require('../');
|
const createProbot = require('../');
|
||||||
|
|
||||||
if(!program.integration) {
|
|
||||||
console.warn("Missing GitHub Integration ID.\nUse --integration flag or set INTEGRATION_ID environment variable.");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!program.cert) {
|
|
||||||
console.warn("Missing GitHub Integration certificate.\nUse --cert flag or set CERT environment variable.");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const probot = createProbot({
|
const probot = createProbot({
|
||||||
id: program.integration,
|
id: program.integration,
|
||||||
secret: program.secret,
|
secret: program.secret,
|
||||||
|
|
Loading…
Reference in New Issue