fix(donate): control plan creation with environment variable

This commit is contained in:
Mrugesh Mohapatra
2019-11-19 14:48:09 +05:30
parent 21b09b53cb
commit 2cb8c16b28
2 changed files with 16 additions and 9 deletions

View File

@ -78,6 +78,7 @@ export default function donateBoot(app, done) {
}
const requiredPlans = subscriptionPlans.map(plan => plan.id);
const availablePlans = stripePlans.data.map(plan => plan.id);
if (process.env.STRIPE_CREATE_PLANS === 'true') {
requiredPlans.forEach(requiredPlan => {
if (!availablePlans.includes(requiredPlan)) {
createStripePlan(
@ -85,6 +86,9 @@ export default function donateBoot(app, done) {
);
}
});
} else {
log(`Skipping plan creation`);
}
});
resolve();
});

View File

@ -16,8 +16,11 @@ SESSION_SECRET=secretstuff
COOKIE_SECRET='this is a secret'
JWT_SECRET='a very long secret'
STRIPE_PUBLIC=pk_from_stipe_dashboard
STRIPE_SECRET=sk_from_stipe_dashboard
STRIPE_CREATE_PLANS=true
STRIPE_PUBLIC_KEY=pk_from_stripe_dashboard
STRIPE_SECRET_KEY=sk_from_stripe_dashboard
SERVICEBOT_ID=servicebot_id_from_servicebot_dashboard
SERVICEBOT_HMAC_SECRET_KEY=secret_key_from_servicebot_dashboard
PAYPAL_SUPPORTERS=1703