change db config

This commit is contained in:
2018-06-01 23:24:22 +03:00
parent f65c7c9a19
commit 38688491f9
2 changed files with 2 additions and 7 deletions

View File

@@ -2,10 +2,7 @@ const mongoose = require('mongoose');
const config = require('./'); const config = require('./');
async function connect() { async function connect() {
const { host, port, name } = config.db; await mongoose.connect(config.db.uri);
const connectionString = `mongodb://${host}:${port}/${name}`;
await mongoose.connect(connectionString);
} }
async function disconnect() { async function disconnect() {

View File

@@ -5,9 +5,7 @@ const dev = {
port: process.env.DEV_APP_PORT || 4000, port: process.env.DEV_APP_PORT || 4000,
}, },
db: { db: {
host: process.env.DEV_DB_HOST || 'localhost', uri: process.env.DEV_DB_URI || 'mongodb://localhost/todolist',
port: process.env.DEV_DB_PORT || 27017,
name: process.env.DEV_DB_NAME || 'todolist',
}, },
secret: process.env.DEV_SECRET || 'devsecret', secret: process.env.DEV_SECRET || 'devsecret',
}; };