2019-12-16 05:42:31 -05:00
|
|
|
const settings = require('settings-sharelatex')
|
|
|
|
const logger = require('logger-sharelatex')
|
2014-02-25 04:10:22 -05:00
|
|
|
|
2020-01-04 12:27:12 -05:00
|
|
|
logger.log(
|
|
|
|
{
|
|
|
|
backend: settings.filestore.backend
|
|
|
|
},
|
|
|
|
'Loading backend'
|
|
|
|
)
|
|
|
|
if (!settings.filestore.backend) {
|
|
|
|
throw new Error('no backend specified - config incomplete')
|
|
|
|
}
|
2014-02-26 06:58:48 -05:00
|
|
|
|
2020-01-04 12:27:12 -05:00
|
|
|
switch (settings.filestore.backend) {
|
|
|
|
case 'aws-sdk':
|
|
|
|
case 's3':
|
|
|
|
module.exports = require('./S3PersistorManager')
|
|
|
|
break
|
|
|
|
case 'fs':
|
|
|
|
module.exports = require('./FSPersistorManager')
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
throw new Error(`unknown filestore backend: ${settings.filestore.backend}`)
|
|
|
|
}
|