Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Micah - removed dependencies on settings files and shifted to environ…

…ment variables. deleted settings files.
  • Loading branch information...
commit 62e37ed1d73996bfd6be6cce80c11be397f593a8 1 parent 354a307
Micah Silverman authored
View
15 app.js
@@ -18,23 +18,20 @@ var app = module.exports = express.createServer();
*/
global.inspect = require('eyes').inspector({ maxLength: 1000 });
-var envPath = './config/environments/' + app.settings.env;
-global.settings = require(envPath + '/settings');
-var mongoConfig = settings.databases.mongo
+global.settings = require('./config/settings');
+
+var mongoConfig = settings.databases.mongo;
var authPart = '';
var sessionStoreSettings = {
- db: settings.databases.mongo.database,
- host: settings.databases.mongo.host,
- port: settings.databases.mongo.port
+ db: mongoConfig.database,
+ host: mongoConfig.host,
+ port: mongoConfig.port
};
if (process.env['NODE_ENV'] === 'production') {
authPart = process.env['MONGO_USER']+':'+process.env['MONGO_PWD']+'@';
sessionStoreSettings.username = process.env['MONGO_USER'];
sessionStoreSettings.password = process.env['MONGO_PWD'];
- sessionStoreSettings.db = mongoConfig.database = process.env['MONGO_DB'];
- sessionStoreSettings.host = mongoConfig.host = process.env['MONGO_HOST'];
- sessionStoreSettings.port = mongoConfig.port = process.env['MONGO_PORT'];
}
var connectStr = 'mongodb://'+authPart+mongoConfig.host+':'+mongoConfig.port+
'/'+mongoConfig.database;
View
11 config/dev_settings.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+MONGO_HOST=localhost
+MONGO_DB=date_a_bank_dev
+MONGO_PORT=27017
+MONGO_TIMEOUT=500
+COOKIE_SECRET="b to the dd"
+TMP_PATH=/tmp
+
+export MONGO_HOST MONGO_DB MONGO_PORT MONGO_TIMEOUT COOKIE_SECRET TMP_PATH
+
View
14 config/environments/development/settings.js.example
@@ -1,14 +0,0 @@
-module.exports = {
- databases: {
- mongo: {
- host: 'hostname'
- database: 'database_name',
- port: 00000,
- user: 'user_name',
- password: 'password_name',
- timeout: 500,
- },
- },
- cookieSecret: 'some secret',
- tmpPath: 'some tmp path'
-}
View
14 config/environments/production/settings.js.example
@@ -1,14 +0,0 @@
-module.exports = {
- databases: {
- mongo: {
- host: 'hostname'
- database: 'database_name',
- port: 00000,
- user: 'user_name',
- password: 'password_name',
- timeout: 500,
- },
- },
- cookieSecret: 'some secret',
- tmpPath: 'some tmp path'
-}
View
14 config/environments/test/settings.js.example
@@ -1,14 +0,0 @@
-module.exports = {
- databases: {
- mongo: {
- host: 'hostname'
- database: 'database_name',
- port: 00000,
- user: 'user_name',
- password: 'password_name',
- timeout: 500,
- },
- },
- cookieSecret: 'some secret',
- tmpPath: 'some tmp path'
-}
View
12 config/settings.js
@@ -0,0 +1,12 @@
+module.exports = {
+ databases: {
+ mongo: {
+ host: process.env['MONGO_HOST'],
+ database: process.env['MONGO_DB'],
+ port: parseInt(process.env['MONGO_PORT']),
+ timeout: process.env['MONGO_TIMEOUT']
+ }
+ },
+ cookieSecret: process.env['COOKIE_SECRET'],
+ tmpPath: process.env['TMP_PATH']
+}
View
11 config/test_settings.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+MONGO_HOST=localhost
+MONGO_DB=date_a_bank_test
+MONGO_PORT=27017
+MONGO_TIMEOUT=500
+COOKIE_SECRET="b to the dd"
+TMP_PATH=/tmp
+
+export MONGO_HOST MONGO_DB MONGO_PORT MONGO_TIMEOUT COOKIE_SECRET TMP_PATH
+
View
4 features/support/env.js
@@ -1,3 +1,3 @@
-global.settings = require('../../config/environments/test/settings');
+global.settings = require('../../config/settings');
-process.env.NODE_ENV='test';
+process.env.NODE_ENV='test';
Please sign in to comment.
Something went wrong with that request. Please try again.