mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
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.
This commit is contained in:
parent
98c27b5555
commit
f890d8d4cd
@ -1,7 +1,17 @@
|
||||
const adapterManager = require('../../services/adapter-manager');
|
||||
|
||||
function getStorage() {
|
||||
return adapterManager.getAdapter('storage');
|
||||
/**
|
||||
* @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;
|
||||
|
Loading…
Reference in New Issue
Block a user