Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
var webhook = env[webhookKey]
var subdomain
if (webhook && webhook.match(/\/\/(\w+)\.ngrok/)) {
subdomain = webhook.match(/\/\/(\w+)\.ngrok/)[1]
}
var ngrokOpts = _.pickBy({
proto: 'http', // http|tcp|tls
addr: env['PORT'], // port or network address
subdomain: subdomain,
authtoken: env['NGROK_AUTH']
})
log.debug(`ngrok options: ${JSON.stringify(ngrokOpts, null, 2)}`)
return ngrok.connectAsync(ngrokOpts)
.then((url) => {
env[webhookKey] = url // update
log.debug(`Set ${env['ADAPTER']} webhook url: ${url}:${env['PORT']}`)
return env
})
.catch((e) => {
log.error(`${JSON.stringify(e, null, 2)}`)
return env
})
}
}