Read .pem from environment variable

This commit is contained in:
Pedro Pombeiro 2018-01-19 17:33:12 +01:00
parent dc0dd954a4
commit 3a9877ee12
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647

View File

@ -37,19 +37,10 @@ module.exports = {
return;
}
const pemFilePath = './status-github-bot.pem';
const jwtLib = require('jwt-simple');
// Private key contents
let privateKey = '';
try {
const fs = require('fs');
privateKey = fs.readFileSync(pemFilePath);
} catch (err) {
robot.logger.error(`Couldn't read ${pemFilePath} file contents: ${err}`);
return;
}
let privateKey = process.env.GITHUB_PEM;
const now = Math.round(Date.now() / 1000);
// Generate the JWT