Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted the config from a setup function into an object that grabs from the NODE_ENV to set the current configurations. Also, config.js was modified for a single object exported with module.exports -- the node documentation prefers that module.exports uses as a single object.
- Loading branch information
1 parent
634b469
commit 755873e
Showing
2 changed files
with
29 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,26 @@ | ||
/* | ||
* modify values in these methods to set | ||
* environment specific info | ||
*/ | ||
function setDevelopmentConfig(){ | ||
// These are just examples, insert you info here | ||
DatabaseConfig.port = 27617; | ||
DatabaseConfig.host = '::mongo host::'; | ||
DatabaseConfig.name = '::collection name::'; | ||
DatabaseConfig.user = '::db username::'; | ||
DatabaseConfig.pass = '::db password::'; | ||
|
||
EnvConfig.port = 3000; | ||
}; | ||
|
||
function setProductionConfig(){ | ||
DatabaseConfig.port = 29017; | ||
DatabaseConfig.host = '::mongo host::'; | ||
DatabaseConfig.name = '::collection name::'; | ||
DatabaseConfig.user = '::db username::'; | ||
DatabaseConfig.pass = '::db password::'; | ||
|
||
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.EnvConfig = EnvConfig; | ||
module.exports.setDevelopmentConfig = setDevelopmentConfig; | ||
module.exports.setProductionConfig = setProductionConfig; | ||
module.exports = { | ||
development: { | ||
DatabaseConfig: { | ||
port: 27617, | ||
host: '::mongo host::', | ||
name: '::collection name::', | ||
user: '::db username::', | ||
pass: '::db password::' | ||
}, | ||
EnvConfig: { | ||
port: 3000 | ||
} | ||
}, | ||
production: { | ||
DatabaseConfig: { | ||
port: 29017, | ||
host: '::mongo host::', | ||
name: '::collection name::', | ||
user: '::db username::', | ||
pass: '::db password::' | ||
}, | ||
EnvConfig: { | ||
port: 80 | ||
} | ||
} | ||
}; |