fix(env): make PayPal env config dynamic

This commit is contained in:
Mrugesh Mohapatra
2020-03-16 14:32:35 +05:30
parent 6c6eadfbe4
commit f9277b4fec
7 changed files with 45 additions and 58 deletions

View File

@@ -1,3 +1,5 @@
require('dotenv').config();
// Configuration for client side
const durationsConfig = {
year: 'yearly',
@@ -40,9 +42,8 @@ const donationSubscriptionConfig = {
};
// Shared paypal configuration
const paypalConfig = {
production: {
webhookId: '8AM40465WC915574A',
const paypalConfigTypes = {
live: {
durationPlans: {
month: {
'500': {
@@ -51,8 +52,7 @@ const paypalConfig = {
}
}
},
development: {
webhookId: '2UL63757DN298592C',
staging: {
durationPlans: {
month: {
'500': {
@@ -63,6 +63,10 @@ const paypalConfig = {
}
};
const paypalConfig = process.env.DEPLOYMENT_ENV
? paypalConfigTypes['live']
: paypalConfigTypes['staging'];
module.exports = {
durationsConfig,
amountsConfig,

View File

@@ -37,7 +37,10 @@ const {
SERVICEBOT_HMAC_SECRET_KEY,
PAYPAL_CLIENT_ID,
PAYPAL_SECRET
PAYPAL_SECRET,
PAYPAL_VERIFY_WEBHOOK_URL,
PAYPAL_API_TOKEN_URL,
PAYPAL_WEBHOOK_ID
} = process.env;
module.exports = {
@@ -104,7 +107,10 @@ module.exports = {
paypal: {
client: PAYPAL_CLIENT_ID,
secret: PAYPAL_SECRET
secret: PAYPAL_SECRET,
verifyWebhookURL: PAYPAL_VERIFY_WEBHOOK_URL,
tokenUrl: PAYPAL_API_TOKEN_URL,
webhookId: PAYPAL_WEBHOOK_ID
},
servicebot: {