0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/server/storage/index.js

27 lines
743 B
JavaScript
Raw Normal View History

var errors = require('../errors'),
storage = {};
function getStorage(storageChoice) {
2014-01-21 03:45:27 -05:00
// TODO: this is where the check for storage apps should go
// Local file system is the default. Fow now that is all we support.
storageChoice = 'local-file-store';
if (storage[storageChoice]) {
return storage[storageChoice];
}
try {
// TODO: determine if storage has all the necessary methods.
storage[storageChoice] = require('./' + storageChoice);
} catch (e) {
errors.logError(e);
}
// Instantiate and cache the storage module instance.
storage[storageChoice] = new storage[storageChoice]();
return storage[storageChoice];
}
module.exports.getStorage = getStorage;