Allow selection of FS persistor manager. Only require the chosen persistor manager.

This commit is contained in:
Oliver Matthews 2014-02-26 15:15:03 +00:00
parent ff96f37b2d
commit 7c5634044f
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,5 @@
settings = require("settings-sharelatex") settings = require("settings-sharelatex")
logger = require("logger-sharelatex") logger = require("logger-sharelatex")
S3PersistorManager = require("./S3PersistorManager")
# assume s3 if none specified # assume s3 if none specified
settings.filestoreBackend ||= "s3" settings.filestoreBackend ||= "s3"
@ -9,6 +8,8 @@ settings.filestoreBackend ||= "s3"
logger.log backend:settings.filestoreBackend, "Loading backend" logger.log backend:settings.filestoreBackend, "Loading backend"
module.exports = switch settings.filestoreBackend module.exports = switch settings.filestoreBackend
when "s3" when "s3"
S3PersistorManager require("./S3PersistorManager")
when "fs"
require("./FSPersistorManager")
else else
throw new Error( "Unknown filestore backend: #{settings.filestoreBackend}" ) throw new Error( "Unknown filestore backend: #{settings.filestoreBackend}" )

View file

@ -7,6 +7,7 @@ module.exports =
# which persistor to use for file storage # which persistor to use for file storage
# current options are: # current options are:
# "s3" - Amazon S3 # "s3" - Amazon S3
# "fs" - local filesystem
# if no persistor is chosen, s3 will be used by default # if no persistor is chosen, s3 will be used by default
filestoreBackend: "s3" filestoreBackend: "s3"