mirror of
https://github.com/wassname/talk.git
synced 2026-08-09 12:30:42 +08:00
default connection string
This commit is contained in:
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
const mongoose = require('mongoose');
|
const mongoose = require('mongoose');
|
||||||
const enabled = require('debug').enabled;
|
const enabled = require('debug').enabled;
|
||||||
|
const url = process.env.TALK_MONGO_URL || 'mongodb://localhost/talk';
|
||||||
|
|
||||||
// Use native promises
|
// Use native promises
|
||||||
mongoose.Promise = global.Promise;
|
mongoose.Promise = global.Promise;
|
||||||
@@ -9,7 +10,7 @@ if (enabled('talk:db')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mongoose.connect(process.env.TALK_MONGO_URL, (err) => {
|
mongoose.connect(url, (err) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
console.log('Connected to MongoDB!');
|
console.log('Connected to MongoDB!');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user