2014-02-25 04:10:22 -05:00
|
|
|
settings = require("settings-sharelatex")
|
2014-02-25 05:54:51 -05:00
|
|
|
logger = require("logger-sharelatex")
|
|
|
|
s3Wrapper = require("./s3Wrapper")
|
|
|
|
testWrapper = require("./testWrapper")
|
2014-02-25 04:10:22 -05:00
|
|
|
|
2014-02-25 05:54:51 -05:00
|
|
|
module.exports =
|
|
|
|
selectBackend: (backend) ->
|
|
|
|
wrappedFs = switch backend
|
|
|
|
when "s3" then s3Wrapper
|
|
|
|
when "test" then testWrapper
|
|
|
|
else null
|
2014-02-25 04:10:22 -05:00
|
|
|
|
2014-02-25 05:54:51 -05:00
|
|
|
if !wrappedFs
|
|
|
|
throw new Error( "Unknown filestore wrapper #{backend}" )
|
|
|
|
|
|
|
|
module.exports[name] = method for name,method of wrappedFs
|
|
|
|
|
|
|
|
if settings.fileStoreWrapper?
|
|
|
|
module.exports.selectBackend(settings.fileStoreWrapper)
|