1
0
mirror of https://github.com/journey-ad/Moe-Counter.git synced 2024-11-27 17:00:51 +01:00

add default mongodb url(local server)

This commit is contained in:
d1y 2020-08-22 00:11:20 +08:00
parent a5130cc5a3
commit d94b2f64ab

View File

@ -3,7 +3,12 @@
const mongoose = require('mongoose')
const schema = require('./schema')
mongoose.connect(process.env.DB_URL, {
// the default mongodb url (local server)
let mongodbURL = `mongodb://127.0.0.1:27017`
const envMongoURL = process.env.DB_URL
if (envMongoURL) mongodbURL = envMongoURL
mongoose.connect(mongodbURL, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false