mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
d0bb8c3333
no-issue
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
const AdapterManager = require('@tryghost/adapter-manager');
|
|
const getAdapterServiceConfig = require('./config');
|
|
const config = require('../../config');
|
|
|
|
const adapterManager = new AdapterManager({
|
|
loadAdapterFromPath: require,
|
|
pathsToAdapters: [
|
|
'', // A blank path will cause us to check node_modules for the adapter
|
|
config.getContentPath('adapters'),
|
|
config.get('paths').internalAdaptersPath
|
|
]
|
|
});
|
|
|
|
adapterManager.registerAdapter('storage', require('ghost-storage-base'));
|
|
adapterManager.registerAdapter('scheduling', require('../../adapters/scheduling/SchedulingBase'));
|
|
adapterManager.registerAdapter('sso', require('../../adapters/sso/Base'));
|
|
|
|
module.exports = {
|
|
getAdapter(adapterType) {
|
|
const adapterServiceConfig = getAdapterServiceConfig(config);
|
|
|
|
const adapterSettings = adapterServiceConfig[adapterType];
|
|
const activeAdapter = adapterSettings.active;
|
|
const activeAdapterConfig = adapterSettings[activeAdapter];
|
|
|
|
return adapterManager.getAdapter(adapterType, activeAdapter, activeAdapterConfig);
|
|
}
|
|
};
|