Ghost/core/server/services/adapter-manager/config.js
Fabien O'Carroll fb942af1db Added adapter-manager service
no-issue

This services handles the registration and retrieval of adapters,
it normalises the config to look like:

{
    [adapterType]: {
        active: adapterName,
        [adapterName]: adapterConfig
    }
}
2020-04-05 21:13:47 +02:00

29 lines
756 B
JavaScript

/**
* {
* [adapterType]: {
* active: [adapterName],
* [adapterName]: {}
* }
* }
*/
module.exports = function getAdapterServiceConfig(config) {
const adapterServiceConfig = config.get('adapters');
if (!adapterServiceConfig.storage) {
adapterServiceConfig.storage = config.get('storage');
}
if (!adapterServiceConfig.scheduling) {
const schedulingConfig = config.get('scheduling');
const activeSchedulingAdapter = schedulingConfig.active;
adapterServiceConfig.scheduling = {
active: activeSchedulingAdapter,
[activeSchedulingAdapter]: {
schedulerUrl: schedulingConfig.schedulerUrl
}
};
}
return adapterServiceConfig;
};