Improve environment variable stuff

This commit is contained in:
Jonathan Cremin 2015-08-30 18:35:05 +02:00
parent 760ee07a2e
commit 6ba174cff0
16 changed files with 66 additions and 64 deletions

View file

@ -3,11 +3,9 @@ const MongoClient = mongodb().MongoClient;
import debugname from 'debug';
const debug = debugname('hostr:mongo');
const uristring = process.env.MONGO_URL || process.env.MONGOLAB_URI || 'mongodb://localhost:27017/hostr';
const configuredClient = new Promise((resolve, reject) => {
debug('Connecting to Mongodb');
return MongoClient.connect(uristring).then((client) => {
return MongoClient.connect(process.env.MONGO_URL).then((client) => {
debug('Successfully connected to Mongodb');
client.Users = client.collection('users');
client.Files = client.collection('files');