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('./');
async function connect() {
const { host, port, name } = config.db;
const connectionString = `mongodb://${host}:${port}/${name}`;
await mongoose.connect(connectionString);
await mongoose.connect(config.db.uri);
}
async function disconnect() {

View File

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