-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
103 lines (87 loc) · 2.33 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
var development = {
appAddress: '127.0.0.1:3000',
// ***REMOVED***
env: process.env.NODE_ENV || 'development',
serverProvider: process.env.SERVER_PROVIDER,
hostIp: getServerConfig(process.env.SERVER_PROVIDER).hostIp,
serverPort: getServerConfig(process.env.SERVER_PROVIDER).port,
session: {
// ***REMOVED***
},
cookie: {
// ***REMOVED***
},
// What permissions a user gets when created
defaultUserPermissions: {
access: true
},
s3Bucket: 'hiburim-test',
mailSender: {
authUsername: '[email protected]',
authPassword: 'hiburim2014',
fromUsername: '[email protected]'
},
uploadFolderPath: 'public/upload',
uiExposedConfig: {
// as opposed to fixture data
useRealData: true,
maxUploadImageSize: 5, //MB
// This is not a real id - don't want tracking on development
//***REMOVED***
}
};
var production = {
appAddress : 'hiburim.herokuapp.com',
//***REMOVED***
env: process.env.NODE_ENV || 'production',
serverProvider: process.env.SERVER_PROVIDER,
hostIp: getServerConfig(process.env.SERVER_PROVIDER).hostIp,
serverPort: getServerConfig(process.env.SERVER_PROVIDER).port,
s3Bucket: 'hiburim',
session: {
// ***REMOVED***
},
cookie: {
// ***REMOVED***
},
// What permissions a user gets when created
defaultUserPermissions: {
access: true
},
mailSender: {
authUsername: '[email protected]',
authPassword: 'hiburim2014',
fromUsername: '[email protected]'
},
uploadFolderPath: 'public/upload',
uiExposedConfig: {
// as opposed to fixture data
useRealData: true,
maxUploadImageSize: 5, //MB
// ***REMOVED***
}
};
function getServerConfig(serverProvider) {
if (!serverProvider) {
console.log('Using local server config');
return {
hostIp: '127.0.0.1',
port: 3000
};
}
if (serverProvider === 'heroku') {
console.log('Using heroku server config');
return {
port: process.env.PORT
};
}
if (serverProvider === 'openshift') {
console.log('Using openshift server config');
return {
hostIp: process.env.OPENSHIFT_NODEJS_IP,
port: process.env.OPENSHIFT_NODEJS_PORT
};
}
console.log('Server provider ' + serverProvider + ' does not fit any sevrer config!!');
}
exports.Config = process.env.NODE_ENV === 'production' ? production : development;