-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
53 lines (44 loc) · 1.5 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
var mongoose = require('mongoose');
/*
* modify values in these methods to set
* environment specific info
*/
function setDevelopmentConfig(){
// These are just examples, insert you info here
DatabaseConfig.port = 27738;
DatabaseConfig.host = 'ds027738.mongolab.com';
DatabaseConfig.name = 'dietzel-congressional';
DatabaseConfig.user = 'sosick_admin';
DatabaseConfig.pass = 'Fake123!';
EnvConfig.port = 3000;
}
function createDatabaseConnection() {
var config = this.DatabaseConfig;
var connString = 'mongodb://' + config.user + ':' + config.pass + '@' + config.host + ':' + config.port + '/' + config.name;
console.log('Connecting to ', connString);
mongoose.connect(connString);
}
function setProductionConfig(){
DatabaseConfig.port = 27738;
DatabaseConfig.host = 'ds027738.mongolab.com';
DatabaseConfig.name = 'dietzel-congressional';
DatabaseConfig.user = 'sosick_admin';
DatabaseConfig.pass = 'Fake123!';
EnvConfig.port = 80;
}
/* --- no need to modify below this line -- */
var DatabaseConfig = {
port : Number,
host : String,
name : String,
user : String,
pass : String
};
var EnvConfig = {
port : Number
};
module.exports.DatabaseConfig = DatabaseConfig;
module.exports.establishDatabaseConnection = createDatabaseConnection;
module.exports.EnvConfig = EnvConfig;
module.exports.setDevelopmentConfig = setDevelopmentConfig;
module.exports.setProductionConfig = setProductionConfig;