2019-04-15 12:42:44 +03:00
|
|
|
const debug = require('ghost-ignition').debug('services:apps');
|
|
|
|
const Promise = require('bluebird');
|
|
|
|
const common = require('../../lib/common');
|
|
|
|
const config = require('../../config');
|
|
|
|
const loader = require('./loader');
|
|
|
|
const internalApps = config.get('apps:internal');
|
2017-10-30 15:31:04 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
init: function () {
|
|
|
|
debug('init begin');
|
2019-04-15 12:42:44 +03:00
|
|
|
const appsToLoad = internalApps;
|
2017-10-30 15:31:04 +03:00
|
|
|
|
2019-04-15 12:42:44 +03:00
|
|
|
return Promise.map(appsToLoad, appName => loader.activateAppByName(appName))
|
2017-10-30 15:31:04 +03:00
|
|
|
.catch(function (err) {
|
2017-12-12 00:47:46 +03:00
|
|
|
common.logging.error(new common.errors.GhostError({
|
2017-10-30 15:31:04 +03:00
|
|
|
err: err,
|
2017-12-12 00:47:46 +03:00
|
|
|
context: common.i18n.t('errors.apps.appWillNotBeLoaded.error'),
|
|
|
|
help: common.i18n.t('errors.apps.appWillNotBeLoaded.help')
|
2017-10-30 15:31:04 +03:00
|
|
|
}));
|
|
|
|
});
|
2019-04-15 12:42:44 +03:00
|
|
|
}
|
2017-10-30 15:31:04 +03:00
|
|
|
};
|