control sequelize logging with env variable
This commit is contained in:
18
config/config.js
Normal file
18
config/config.js
Normal file
@@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
development: {
|
||||
username: 'docker',
|
||||
password: 'docker',
|
||||
database: 'CrmIntegration',
|
||||
port: '5431',
|
||||
dialect: 'postgres',
|
||||
logging: parseInt(process.env.SEQUELIZE_LOGGING) ? console.log : false
|
||||
},
|
||||
test: {
|
||||
"use_env_variable": 'DATABASE_URL',
|
||||
logging: parseInt(process.env.SEQUELIZE_LOGGING) ? console.log : false
|
||||
},
|
||||
production: {
|
||||
"use_env_variable": 'DATABASE_URL',
|
||||
logging: parseInt(process.env.SEQUELIZE_LOGGING) ? console.log : false
|
||||
}
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"development": {
|
||||
"username": "docker",
|
||||
"password": "docker",
|
||||
"database": "CrmIntegration",
|
||||
"port": "5431",
|
||||
"dialect": "postgres",
|
||||
"logging": false
|
||||
},
|
||||
"test": {
|
||||
"use_env_variable": "DATABASE_URL"
|
||||
},
|
||||
"production": {
|
||||
"use_env_variable": "DATABASE_URL"
|
||||
}
|
||||
}
|
||||
@@ -22,3 +22,5 @@ UNLOCK_STREAK_REPAIR_AFTER=Number of months without incidents to reset user inci
|
||||
BOOKING_CHANGE_PERCENTAGE_CHARGE=Percentage of hourly reate to apply for cancellation-like charges
|
||||
|
||||
ALLOWED_BOOKING_CANCELLATION_TIME=Time from creation (in minutes) in which cancellation is not charged
|
||||
|
||||
SEQUELIZE_LOGGING=0 - false, 1 - true (console logging)
|
||||
|
||||
@@ -5,7 +5,7 @@ const path = require('path');
|
||||
const Sequelize = require('sequelize');
|
||||
const basename = path.basename(__filename);
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const config = require(__dirname + '/../config/config.json')[env];
|
||||
const config = require(__dirname + '/../config/config.js')[env];
|
||||
const db = {};
|
||||
|
||||
let sequelize;
|
||||
|
||||
Reference in New Issue
Block a user