From 0a63131f12aec1540d60c0c9ef1ca9776f1d2855 Mon Sep 17 00:00:00 2001 From: kdam0 Date: Mon, 2 Jan 2017 13:11:32 -0500 Subject: add confg vars support to use dev db --- node_simple.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'node_simple.js') diff --git a/node_simple.js b/node_simple.js index 2f49360..0ccf76a 100644 --- a/node_simple.js +++ b/node_simple.js @@ -103,8 +103,14 @@ var _ = require('underscore'); var db; // Standard URI format: mongodb://[dbuser:dbpassword@]host:port/dbname -var uri = exports.uri = 'mongodb://general:assignment4@ds057862.mlab.com:57862/solutions_repo'; - +if (NODE_ENV == 'staging') { + var uri = exports.uri = 'mongodb://root:solutions_repo@ds023624.mlab.com:23624/solutions_staging'; +} else if (NODE_ENV == 'production') { + var uri = exports.uri = 'mongodb://general:assignment4@ds057862.mlab.com:57862/solutions_repo'; +} else if (NODE_ENV == 'development') { + // Keep this for testing on local machine, do not remove. - Humair + //var uri = 'mongodb://localhost:27017/db'; +} // Keep this for testing on local machine, do not remove. - Humair //var uri = 'mongodb://localhost:27017/db'; -- cgit v1.2.3 From cbccf154d96abadd5bf3dc0bdcf379d02101f221 Mon Sep 17 00:00:00 2001 From: kdam0 Date: Mon, 2 Jan 2017 13:15:22 -0500 Subject: fixed the node_env defined --- node_simple.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'node_simple.js') diff --git a/node_simple.js b/node_simple.js index 0ccf76a..f7d2289 100644 --- a/node_simple.js +++ b/node_simple.js @@ -103,11 +103,11 @@ var _ = require('underscore'); var db; // Standard URI format: mongodb://[dbuser:dbpassword@]host:port/dbname -if (NODE_ENV == 'staging') { +if (process.env.NODE_ENV == 'staging') { var uri = exports.uri = 'mongodb://root:solutions_repo@ds023624.mlab.com:23624/solutions_staging'; -} else if (NODE_ENV == 'production') { +} else if (process.env.NODE_ENV == 'production') { var uri = exports.uri = 'mongodb://general:assignment4@ds057862.mlab.com:57862/solutions_repo'; -} else if (NODE_ENV == 'development') { +} else if (process.env.NODE_ENV == 'development') { // Keep this for testing on local machine, do not remove. - Humair //var uri = 'mongodb://localhost:27017/db'; } -- cgit v1.2.3