Ghost/core/server/adapters/storage/index.js
Naz f890d8d4cd Enabled passing through a feature name to utilize with a storage adapter
refs https://linear.app/tryghost/issue/CORE-1/multiple-adapters-per-type

- When the storage is requested the caller can now specify a "feature" they want to use the storage for. For example there could be different configurations for "images" or "vidoes" storages and the caller would not necessarily have to know about the details of how the feature is implemented.
2021-10-21 20:22:45 +13:00

18 lines
468 B
JavaScript

const adapterManager = require('../../services/adapter-manager');
/**
* @param {'images'|'videos'|'audios'} [feature] - name for the "feature" to enable through adapter, e.g.: images or videos storage
* @returns {Object} adapter instance
*/
function getStorage(feature) {
let adapterName = 'storage';
if (feature) {
adapterName += `:${feature}`;
}
return adapterManager.getAdapter(adapterName);
}
module.exports.getStorage = getStorage;