mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
15d9a77092
* moved `server/config` to `shared/config` * updated config import paths in server to use shared * updated config import paths in frontend to use shared * updated config import paths in test to use shared * updated config import paths in root to use shared * trigger regression tests * of course the rebase broke tests
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('../../../shared/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);
|
|
}
|
|
};
|