36 lines
879 B
JavaScript
Raw Normal View History

'use strict';
2018-05-04 18:27:39 +02:00
/* eslint-disable import/no-unresolved */
// Node.js core.
const execSync = require('child_process').execSync;
// Logger.
const logger = require('strapi-utils').logger;
module.exports = (scope, success, error) => {
const Redis = require(`${scope.tmpPath}/node_modules/ioredis`);
const redis = new Redis({
port: scope.database.settings.port,
host: scope.database.settings.host,
2018-01-17 10:13:23 +01:00
password: scope.database.settings.password,
db: scope.database.settings.database
});
redis.connect((err) => {
redis.disconnect();
if (err) {
2018-01-10 18:08:43 +01:00
logger.warn('Database connection has failed! Make sure your database is running.');
return error();
}
2018-01-10 18:08:43 +01:00
logger.info('The app has been connected to the database successfully!');
2018-03-18 13:29:49 +01:00
execSync(`rm -r "${scope.tmpPath}"`);
logger.info('Copying the dashboard...');
success();
});
};