36 lines
831 B
JavaScript
Raw Normal View History

'use strict';
// Node.js core.
const execSync = require('child_process').execSync;
const path = require('path');
// Logger.
const logger = require('strapi-utils').logger;
module.exports = (scope, success, error) => {
const Redis = require(`${scope.rootPath}/node_modules/ioredis`);
const redis = new Redis({
port: scope.database.port,
host: scope.database.host,
password: scope.database.password,
db: scope.database.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!');
execSync(`rm -r ${scope.rootPath}`);
logger.info('Copying the dashboard...');
success();
});
};