diff --git a/config/config.js b/config/config.js new file mode 100644 index 0000000..3bb20d6 --- /dev/null +++ b/config/config.js @@ -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 + } +}; diff --git a/config/config.json b/config/config.json deleted file mode 100644 index bb7a042..0000000 --- a/config/config.json +++ /dev/null @@ -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" - } -} diff --git a/environment.env b/environment.env index b4f3c76..b77df6a 100644 --- a/environment.env +++ b/environment.env @@ -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) diff --git a/models/index.js b/models/index.js index a750de4..9f372c9 100644 --- a/models/index.js +++ b/models/index.js @@ -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;