ILibraryStorageinterface that stores the metadata of libraries in MongoDB and the files in S3. You can find the storage class in /packages/h5p-mongos3/src/MongoS3LibraryStorage.ts.
npm install aws-sdk mongodb!
createIndexes()every time you start you application, as MongoDB checks if indexes already exist before it creates new ones.
initMongothrough the function parameters. Alternatively you can use these environment variables instead of using the function parameters:
h5pto any name you want. If the collection doesn't exist yet, it will be automatically created.
h5plibrarybucketto any name you want, but you must specify one. You must create the bucket manually before you can use it.
initS3is passed on to
aws-sdk, so you can set any custom configuration values you want.
initMongoand instantiate the required clients yourself.
maxKeyLengthto the value you need. It defaults to 1024.
/test/implementation/db/MongoS3LibraryStorage.test.ts. However, these tests will not be called automatically when you run
npm run testor other test calls. The reason is that the tests require a running MongoDB and S3 instance and thus need more extensive setup. To manually execute the tests call
npm run test:db.