2020-04-05 11:52:46 -05:00
|
|
|
/**
|
2021-10-20 02:10:22 -05:00
|
|
|
* Maps configuration from the config file to a unified adapter config in following form:
|
2020-04-05 11:52:46 -05:00
|
|
|
* {
|
|
|
|
* [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;
|
|
|
|
};
|