-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.js
51 lines (40 loc) · 1.13 KB
/
config.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
const _ = require('underscore');
const fb = require("firebase");
const requiredParams = [
'PRERANA_LOG_PATH',
'PRERANA_PORT',
'PRERANA_MODE',
'PRERANA_API_KEY',
'PRERANA_AUTH_DOMAIN',
'PRERANA_DATABASE_URL',
'PRERANA_PROJECT_ID',
'PRERANA_STORAGE_BUCKET',
'PRERANA_MESSAGE_SENDER_ID'
];
for (let i = 0; i < requiredParams.length; i++) {
if (!_.has(process.env, requiredParams[i])) {
console.log(
'Error: environment variables have not been properly setup.',
'The variable:',
requiredParams[i],
'was not found.'
);
throw new Error('Prerana Environment Variables Not Properly Set');
}
}
const dbDetails = {
apiKey: process.env.PRERANA_API_KEY,
authDomain: process.env.PRERANA_AUTH_DOMAIN,
databaseURL: process.env.PRERANA_DATABASE_URL,
projectId: process.env.PRERANA_PROJECT_ID,
storageBucket: process.env.PRERANA_STORAGE_BUCKET,
messagingSenderId: process.env.PRERANA_MESSAGE_SENDER_ID
};
module.exports = {
appName: 'Prerana',
port: process.env.PRERANA_PORT,
mode: process.env.PRERANA_MODE,
db_details: dbDetails,
firebase: fb.initializeApp(dbDetails)
};