3 var path = require('path');
4 var _ = require('lodash');
6 function requiredProcessEnv(name) {
7 if (!process.env[name]) {
8 throw new Error('You must set the ' + name + ' environment variable');
10 return process.env[name];
13 // All configurations will extend these options
14 // ============================================
16 env: process.env.NODE_ENV,
17 // Root path of server
18 root: path.normalize(__dirname + '/../../..'),
21 moh: path.normalize(__dirname + '/../../..' + '/server/files/moh'),
23 // Root path of saved reports
24 reports: path.normalize(__dirname + '/../../..' + '/server/files/reports/'),
27 fonts: path.normalize(__dirname + '/../../..' + '/server/utils/fonts/'),
29 // Root path of original sounds
30 originalSounds: path.normalize(__dirname + '/../../..' + '/server/files/sounds/original'),
32 // Root path of converted sounds
33 convertedSounds: path.normalize(__dirname + '/../../..' + '/server/files/sounds/converted'),
36 port: process.env.PORT || 9000,
39 ip: process.env.IP || 'localhost',
41 // Should we populate the DB with sample data?
44 // Secret for session, you will want to change this and make it an environment variable
46 name: 'xcally-motion',
47 secret: 'xcally-motion-session-secret',
51 // If secure is set to true then it will cause the cookie to be set
52 // only when SSL-enabled (HTTPS) is used, and otherwise it won't
53 // set a cookie. 'true' is recommended yet it requires the above
54 // mentioned pre-requisite.
56 // Only set the maxAge to null if the cookie shouldn't be expired
57 // at all. The cookie will expunge when the browser is closed.
63 userRoles: ['guest', 'user', 'admin'],
66 clientID: process.env.FACEBOOK_ID || 'id',
67 clientSecret: process.env.FACEBOOK_SECRET || 'secret',
68 callbackURL: (process.env.DOMAIN || '') + '/auth/facebook/callback'
72 clientID: process.env.TWITTER_ID || 'id',
73 clientSecret: process.env.TWITTER_SECRET || 'secret',
74 callbackURL: (process.env.DOMAIN || '') + '/auth/twitter/callback'
78 clientID: process.env.GOOGLE_ID || 'id',
79 clientSecret: process.env.GOOGLE_SECRET || 'secret',
80 callbackURL: (process.env.DOMAIN || '') + '/auth/google/callback'
84 // Export the config object based on the NODE_ENV
85 // ==============================================
86 module.exports = _.merge(
88 require('./' + process.env.NODE_ENV + '.js') || {});