From 0149dd8f4d973618044cfc1f616a039ba3f63f1b Mon Sep 17 00:00:00 2001 From: Naz Gargol Date: Mon, 25 Nov 2019 13:15:28 +0700 Subject: [PATCH] Added priority to webhook secret if present in env (#103) no issue - When debugging Stripe with using: `stripe listen \ --forward-to http://ghost.local/members/webhooks/stripe/` this priority is nice to have so that Ghost process can be initialized using WEBHOOK_SECRET env variable - It was not working in current form because Stripe recognized `ghost.local` as a valid domain and didn't throw any errors - Removed unneeded secret assignment in a catch statement. It is redundant with the new implementation --- ghost/members-api/lib/stripe/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ghost/members-api/lib/stripe/index.js b/ghost/members-api/lib/stripe/index.js index 30630d0878..fa721d6fff 100644 --- a/ghost/members-api/lib/stripe/index.js +++ b/ghost/members-api/lib/stripe/index.js @@ -62,10 +62,9 @@ module.exports = class StripePaymentProcessor { 'invoice.payment_failed' ] }); - this._webhookSecret = webhook.secret; + this._webhookSecret = process.env.WEBHOOK_SECRET || webhook.secret; } catch (err) { this.logging.warn(err); - this._webhookSecret = process.env.WEBHOOK_SECRET; } debug(`Webhook secret set to ${this._webhookSecret}`); } catch (err) {