diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/database.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/initializers/database.js b/server/initializers/database.js index cc6f59b63..9642231b9 100644 --- a/server/initializers/database.js +++ b/server/initializers/database.js | |||
@@ -6,13 +6,24 @@ const Sequelize = require('sequelize') | |||
6 | 6 | ||
7 | const constants = require('../initializers/constants') | 7 | const constants = require('../initializers/constants') |
8 | const logger = require('../helpers/logger') | 8 | const logger = require('../helpers/logger') |
9 | const utils = require('../helpers/utils') | ||
9 | 10 | ||
10 | const database = {} | 11 | const database = {} |
11 | 12 | ||
12 | const sequelize = new Sequelize(constants.CONFIG.DATABASE.DBNAME, 'peertube', 'peertube', { | 13 | const sequelize = new Sequelize(constants.CONFIG.DATABASE.DBNAME, 'peertube', 'peertube', { |
13 | dialect: 'postgres', | 14 | dialect: 'postgres', |
14 | host: constants.CONFIG.DATABASE.HOSTNAME, | 15 | host: constants.CONFIG.DATABASE.HOSTNAME, |
15 | port: constants.CONFIG.DATABASE.PORT | 16 | port: constants.CONFIG.DATABASE.PORT, |
17 | benchmark: utils.isTestInstance(), | ||
18 | |||
19 | logging: function (message, benchmark) { | ||
20 | let newMessage = message | ||
21 | if (benchmark !== undefined) { | ||
22 | newMessage += ' | ' + benchmark + 'ms' | ||
23 | } | ||
24 | |||
25 | logger.debug(newMessage) | ||
26 | } | ||
16 | }) | 27 | }) |
17 | 28 | ||
18 | const modelDirectory = path.join(__dirname, '..', 'models') | 29 | const modelDirectory = path.join(__dirname, '..', 'models') |