From 841e83396274b5ce04ab2966c136a9b2a0ce88ce Mon Sep 17 00:00:00 2001 From: Gino Bustelo Date: Sat, 27 Aug 2016 22:13:22 -0500 Subject: [PATCH] Rename the database from test --- config/config.js | 43 +++++++++++++++++++++++++++---------------- lib/models/index.js | 2 +- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/config/config.js b/config/config.js index ca93a52..1ead79b 100644 --- a/config/config.js +++ b/config/config.js @@ -1,19 +1,30 @@ module.exports = { - "development": { - "username": "test", - "password": "test", - "database": "test", - "host": process.env.DB_HOST || "127.0.0.1", - "dialect": "postgres", - "migrationStorage": "none", - "logging": (process.env.DB_DEBUG==='true') - }, - "production": { - "username": "root", - "password": null, - "database": "database_production", - "host": process.env.DB_HOST || "127.0.0.1", - "dialect": "postgres", - "logging": (process.env.DB_DEBUG==='true') + db: { + "test": { + "username": "test", + "password": "test", + "database": "giphy_bot_test", + "host": process.env.DB_HOST || "127.0.0.1", + "dialect": "postgres", + "migrationStorage": "none", + "logging": (process.env.DB_DEBUG==='true') + }, + "development": { + "username": "test", + "password": "test", + "database": "giphy_bot_dev", + "host": process.env.DB_HOST || "127.0.0.1", + "dialect": "postgres", + "migrationStorage": "none", + "logging": (process.env.DB_DEBUG==='true') + }, + "production": { + "username": "root", + "password": null, + "database": "giphy_bot_prod", + "host": process.env.DB_HOST || "127.0.0.1", + "dialect": "postgres", + "logging": (process.env.DB_DEBUG==='true') + } } } diff --git a/lib/models/index.js b/lib/models/index.js index b5c7ed1..a2b7ee2 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -5,7 +5,7 @@ var path = require('path'); var Sequelize = require('sequelize'); var basename = path.basename(module.filename); var env = process.env.NODE_ENV || 'development'; -var config = require(__dirname + '/../../config/config')[env]; +var config = require(__dirname + '/../../config/config').db[env]; var db = {}; if (config.use_env_variable) {