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,
19 uuid: exec('dmidecode --string system-uuid', {
21 }).output.replace(/\r?\n|\r/g, ""),
23 // Root path of server
24 root: path.normalize(__dirname + '/../../..'),
27 moh: path.normalize(__dirname + '/../../..' + '/server/files/moh'),
29 // Root path of saved reports
30 reports: path.normalize(__dirname + '/../../..' + '/server/files/reports/'),
33 fonts: path.normalize(__dirname + '/../../..' + '/server/utils/fonts/'),
36 originalSounds: path.normalize(__dirname + '/../../..' + '/server/files/sounds/original'),
39 convertedSounds: path.normalize(__dirname + '/../../..' + '/server/files/sounds/converted'),
42 port: process.env.PORT || 9000,
45 ip: process.env.IP || 'localhost',
47 // Should we populate the DB with sample data?
50 // Secret for session, you will want to change this and make it an environment variable
52 name: 'xcally-motion',
53 secret: 'xcally-motion-session-secret',
57 // If secure is set to true then it will cause the cookie to be set
58 // only when SSL-enabled (HTTPS) is used, and otherwise it won't
59 // set a cookie. 'true' is recommended yet it requires the above
60 // mentioned pre-requisite.
62 // Only set the maxAge to null if the cookie shouldn't be expired
63 // at all. The cookie will expunge when the browser is closed.
69 userRoles: ['guest', 'user', 'admin'],
72 clientID: process.env.FACEBOOK_ID || 'id',
73 clientSecret: process.env.FACEBOOK_SECRET || 'secret',
74 callbackURL: (process.env.DOMAIN || '') + '/auth/facebook/callback'
78 clientID: process.env.TWITTER_ID || 'id',
79 clientSecret: process.env.TWITTER_SECRET || 'secret',
80 callbackURL: (process.env.DOMAIN || '') + '/auth/twitter/callback'
84 clientID: process.env.GOOGLE_ID || 'id',
85 clientSecret: process.env.GOOGLE_SECRET || 'secret',
86 callbackURL: (process.env.DOMAIN || '') + '/auth/google/callback'
90 // Export the config object based on the NODE_ENV
91 // ==============================================
92 module.exports = _.merge(
94 require('./' + process.env.NODE_ENV + '.js') || {});