overleaf/services/filestore/app/coffee/PersistorManager.coffee
Xavier Trochu 41397821b1 Add a manager using the aws-sdk library
The knox library does not support the AWS Instance Role.
So use the official AWS SDK to connect to S3
2015-07-22 16:42:45 +02:00

17 lines
494 B
CoffeeScript

settings = require("settings-sharelatex")
logger = require("logger-sharelatex")
# assume s3 if none specified
settings.filestore.backend ||= "s3"
logger.log backend:settings.filestore.backend, "Loading backend"
module.exports = switch settings.filestore.backend
when "aws-sdk"
require "./AWSSDKPersistorManager"
when "s3"
require("./S3PersistorManager")
when "fs"
require("./FSPersistorManager")
else
throw new Error( "Unknown filestore backend: #{settings.filestore.backend}" )