@@ -10,7 +10,7 @@ const DEFAULT_ENDPOINT = '/'
1010const DEFAULT_TUNNEL = false
1111
1212class Webhook {
13- constructor ( { secret, token, webhookOpts = { } , onEvents, onWebhook, onTunnel} ) {
13+ constructor ( { secret, token, options = { } , onEvents, onWebhook, onTunnel} ) {
1414 this . secret = secret
1515 this . token = token
1616 this . onEvents = onEvents
@@ -21,10 +21,10 @@ class Webhook {
2121 this . _createTunnel = this . _createTunnel . bind ( this )
2222
2323 const app = express ( )
24- const APP_PORT = webhookOpts . port || DEFAULT_PORT
25- const APP_ENDPOINT = webhookOpts . endpoint || DEFAULT_ENDPOINT
26- const APP_TUNNEL = webhookOpts . tunnel || webhookOpts . ngrok || DEFAULT_TUNNEL
27- const IS_VERIFY_SIGNATURE = webhookOpts . verifySignature || false
24+ const APP_PORT = options . port || DEFAULT_PORT
25+ const APP_ENDPOINT = options . endpoint || DEFAULT_ENDPOINT
26+ const APP_TUNNEL = options . tunnel || options . ngrok || DEFAULT_TUNNEL
27+ const IS_VERIFY_SIGNATURE = options . verifySignature || false
2828
2929 app . use ( morgan ( 'dev' ) )
3030 if ( IS_VERIFY_SIGNATURE ) {
@@ -44,7 +44,7 @@ class Webhook {
4444 this . _webserver = app
4545 this . _webserver . listen ( APP_PORT , ( err ) => {
4646 if ( ! err ) {
47- onWebhook ( APP_PORT )
47+ onWebhook ( { port : APP_PORT , endpoint : APP_ENDPOINT } )
4848 if ( APP_TUNNEL ) {
4949 this . _createTunnel ( APP_PORT ) . then ( onTunnel ) . catch ( onTunnel )
5050 }
0 commit comments