mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
19 lines
735 B
JavaScript
19 lines
735 B
JavaScript
|
module.exports = function resolveAdapterOptions(name, adapterServiceConfig) {
|
||
|
const [adapterType, feature] = name.split(':');
|
||
|
const adapterSettings = adapterServiceConfig[adapterType];
|
||
|
|
||
|
let adapterName;
|
||
|
let adapterConfig;
|
||
|
|
||
|
// CASE: load resource-specific adapter when there is an adapter feature name specified as well as custom feature config
|
||
|
if (feature && adapterSettings[feature] && adapterSettings[adapterSettings[feature]]) {
|
||
|
adapterName = adapterSettings[feature];
|
||
|
adapterConfig = adapterSettings[adapterName];
|
||
|
} else {
|
||
|
adapterName = adapterSettings.active;
|
||
|
adapterConfig = adapterSettings[adapterName];
|
||
|
}
|
||
|
|
||
|
return {adapterType, adapterName, adapterConfig};
|
||
|
};
|