2020-03-20 11:58:26 +03:00
|
|
|
const debug = require('ghost-ignition').debug('services:apps');
|
|
|
|
const Promise = require('bluebird');
|
2021-05-03 19:29:44 +03:00
|
|
|
const i18n = require('../../../shared/i18n');
|
2020-05-28 21:30:23 +03:00
|
|
|
const logging = require('../../../shared/logging');
|
2020-05-22 21:22:20 +03:00
|
|
|
const errors = require('@tryghost/errors');
|
2020-05-27 20:47:53 +03:00
|
|
|
const config = require('../../../shared/config');
|
2020-03-20 11:58:26 +03:00
|
|
|
const loader = require('./loader');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
init: function () {
|
|
|
|
debug('init begin');
|
|
|
|
const appsToLoad = config.get('apps:internal');
|
|
|
|
|
|
|
|
return Promise.map(appsToLoad, appName => loader.activateAppByName(appName))
|
|
|
|
.catch(function (err) {
|
2020-05-22 21:22:20 +03:00
|
|
|
logging.error(new errors.GhostError({
|
2020-03-20 11:58:26 +03:00
|
|
|
err: err,
|
2020-05-22 21:22:20 +03:00
|
|
|
context: i18n.t('errors.apps.appWillNotBeLoaded.error'),
|
|
|
|
help: i18n.t('errors.apps.appWillNotBeLoaded.help')
|
2020-03-20 11:58:26 +03:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|