forked from mergeability/mergeable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
24 lines (20 loc) · 825 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { Mergeable } = require('./lib/mergeable')
const logger = require('./lib/logger')
const githubRateLimitEndpoint = require('./lib/utils/githubRateLimitEndpoint')
const prometheusMiddleware = require('express-prometheus-middleware')
module.exports = (robot, { getRouter }) => {
if (getRouter !== undefined) {
const router = getRouter()
if (process.env.ENABLE_GITHUB_RATELIMIT_ENDPOINT === 'true') {
// endpoint to fetch github given installation rate limit
router.get('/github-ratelimit/:installationId', githubRateLimitEndpoint(robot))
}
if (process.env.ENABLE_METRICS_ENDPOINT === 'true') {
// expose prometheus metrics
router.use(prometheusMiddleware())
}
}
logger.init(robot.log)
const mergeable = new Mergeable(process.env.NODE_ENV)
mergeable.start(robot)
}