2c3abeee03
closes #4069 - Rename everything from camelCase to lowercase + dashes - Remove usage of `server`, `app` and `instance`
27 lines
743 B
JavaScript
27 lines
743 B
JavaScript
var errors = require('../errors'),
|
|
storage = {};
|
|
|
|
function getStorage(storageChoice) {
|
|
// 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;
|