status-github-bot/lib/config.js

23 lines
411 B
JavaScript
Raw Normal View History

2018-01-22 17:22:32 +00:00
// Description:
// Configuration-related functionality
//
// Dependencies:
// js-yaml: "^3.10.0"
//
// Author:
// PombeirP
module.exports = (robot, fileName) => {
// Get document, or throw exception on error
try {
2018-01-23 14:27:25 +00:00
const yaml = require('js-yaml')
const fs = require('fs')
2018-01-22 17:22:32 +00:00
2018-01-23 14:27:25 +00:00
return yaml.safeLoad(fs.readFileSync(fileName, 'utf8'))
2018-01-22 17:22:32 +00:00
} catch (e) {
2018-01-23 14:27:25 +00:00
robot.log.error(e)
2018-01-22 17:22:32 +00:00
}
2018-01-23 14:27:25 +00:00
return null
2018-01-22 17:22:32 +00:00
}