Remove wrapper function in PersistorManager

This commit is contained in:
Simon Detheridge 2020-01-04 17:27:12 +00:00
parent dbfacce988
commit 0329c759dc

View file

@ -1,28 +1,26 @@
const settings = require('settings-sharelatex')
const logger = require('logger-sharelatex')
module.exports = (function() {
logger.log(
{
backend: settings.filestore.backend
},
'Loading backend'
)
logger.log(
{
backend: settings.filestore.backend
},
'Loading backend'
)
if (!settings.filestore.backend) {
throw new Error('no backend specified - config incomplete')
}
if (!settings.filestore.backend) {
throw new Error('no backend specified - config incomplete')
}
switch (settings.filestore.backend) {
case 'aws-sdk':
return require('./AWSSDKPersistorManager')
case 's3':
return require('./S3PersistorManager')
case 'fs':
return require('./FSPersistorManager')
default:
throw new Error(
`unknown filestore backend: ${settings.filestore.backend}`
)
}
})()
switch (settings.filestore.backend) {
case 'aws-sdk':
module.exports = require('./AWSSDKPersistorManager')
break
case 's3':
module.exports = require('./S3PersistorManager')
break
case 'fs':
module.exports = require('./FSPersistorManager')
break
default:
throw new Error(`unknown filestore backend: ${settings.filestore.backend}`)
}