TwoToc code
[YouAndWeb_TwoToc] / server / config / environment / index.js
1 'use strict';
2
3 var path = require('path');
4 var _ = require('lodash');
5
6 function requiredProcessEnv(name) {
7   if (!process.env[name]) {
8     throw new Error('You must set the ' + name + ' environment variable');
9   }
10   return process.env[name];
11 }
12
13 // All configurations will extend these options
14 // ============================================
15 var all = {
16   env: process.env.NODE_ENV,
17
18   // Root path of server
19   root: path.normalize(__dirname + '/../../..'),
20
21   // Server port
22   port: process.env.PORT || 9000,
23
24   // Server IP
25   ip: process.env.IP || '0.0.0.0',
26
27   // Should we populate the DB with sample data?
28   seedDB: false,
29
30   // Secret for session, you will want to change this and make it an environment variable
31   secrets: {
32     session: 'dashboard-secret'
33   },
34
35   // List of user roles
36   userRoles: ['guest', 'user', 'admin'],
37
38   // MongoDB connection options
39   mongo: {
40     options: {
41       db: {
42         safe: true
43       }
44     }
45   },
46
47   facebook: {
48     clientID:     process.env.FACEBOOK_ID || 'id',
49     clientSecret: process.env.FACEBOOK_SECRET || 'secret',
50     callbackURL:  (process.env.DOMAIN || '') + '/auth/facebook/callback'
51   },
52
53   twitter: {
54     clientID:     process.env.TWITTER_ID || 'id',
55     clientSecret: process.env.TWITTER_SECRET || 'secret',
56     callbackURL:  (process.env.DOMAIN || '') + '/auth/twitter/callback'
57   },
58
59   google: {
60     clientID:     process.env.GOOGLE_ID || 'id',
61     clientSecret: process.env.GOOGLE_SECRET || 'secret',
62     callbackURL:  (process.env.DOMAIN || '') + '/auth/google/callback'
63   }
64 };
65
66 // Export the config object based on the NODE_ENV
67 // ==============================================
68 module.exports = _.merge(
69   all,
70   require('./' + process.env.NODE_ENV + '.js') || {});