Skip to content

Commit

Permalink
web hook with secret
Browse files Browse the repository at this point in the history
  • Loading branch information
derhuerst committed Mar 7, 2018
1 parent 7c3505a commit 3184ef7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ if (!TOKEN) {
console.error('Missing TOKEN env var.')
process.exit(1)
}

const HOSTNAME = process.env.HOSTNAME
if (!HOSTNAME) {
console.error('Missing HOSTNAME env var.')
const WEB_HOOK = process.env.WEB_HOOK
if (!WEB_HOOK) {
console.error('Missing WEB_HOOK env var.')
process.exit(1)
}

Expand All @@ -45,9 +44,7 @@ let api
if (process.env.NODE_ENV === 'production') {
console.info('using web hooks at ' + HOSTNAME)
api = new Api(TOKEN, {polling: false})
api.setWebHook(HOSTNAME, {
certificate: `/etc/letsencrypt/live/${HOSTNAME}/fullchain.pem`
})
api.setWebHook(WEB_HOOK)
} else {
console.info('using polling')
api = new Api(TOKEN, {polling: true})
Expand Down

0 comments on commit 3184ef7

Please sign in to comment.