Improve environment variable stuff
This commit is contained in:
parent
760ee07a2e
commit
6ba174cff0
16 changed files with 66 additions and 64 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue