-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-env.js
28 lines (25 loc) · 1.24 KB
/
get-env.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var ENV = {
IN_PRODUCTION: process.env.NODE_ENV === 'production'
};
if (ENV.IN_PRODUCTION) {
ENV.KINVEY_APP_KEY = process.env.TSC_KINVEY_PRODUCTION_APP_KEY;
ENV.KINVEY_APP_SECRET = process.env.TSC_KINVEY_PRODUCTION_APP_SECRET;
ENV.KINVEY_MASTER_SECRET = process.env.TSC_KINVEY_PRODUCTION_MASTER_SECRET;
ENV.STRIPE_SECRET = process.env.TSC_STRIPE_LIVE_SECRET_KEY;
ENV.STRIPE_PUBLISHABLE_KEY = process.env.TSC_STRIPE_LIVE_PUBLISHABLE_KEY;
} else {
ENV.KINVEY_APP_KEY = process.env.TSC_KINVEY_STAGING_APP_KEY;
ENV.KINVEY_APP_SECRET = process.env.TSC_KINVEY_STAGING_APP_SECRET;
ENV.KINVEY_MASTER_SECRET = process.env.TSC_KINVEY_STAGING_MASTER_SECRET;
ENV.STRIPE_SECRET = process.env.TSC_STRIPE_TEST_SECRET_KEY;
ENV.STRIPE_PUBLISHABLE_KEY = process.env.TSC_STRIPE_TEST_PUBLISHABLE_KEY;
}
//
// Throw if missing ENV
//
if (!ENV.KINVEY_APP_KEY) throw 'See README. Missing KINVEY_APP_KEY.';
if (!ENV.KINVEY_APP_SECRET) throw 'See README. Missing KINVEY_APP_SECRET.';
if (!ENV.KINVEY_MASTER_SECRET) throw 'See README. Missing KINVEY_MASTER_SECRET.';
if (!ENV.STRIPE_SECRET) throw 'See README. Missing STRIPE_SECRET.';
if (!ENV.STRIPE_PUBLISHABLE_KEY) throw 'See README. Missing STRIPE_PUBLISHABLE_KEY.';
module.exports = ENV;