fix: custom database options are not passed to MongoDB GridFS (#7911)

This commit is contained in:
dblythy
2022-04-04 10:04:37 +10:00
committed by Manuel Trezza
parent a169663304
commit b1e5565b22
2 changed files with 24 additions and 2 deletions

View File

@@ -91,12 +91,20 @@ export function getLoggerController(options: ParseServerOptions): LoggerControll
}
export function getFilesController(options: ParseServerOptions): FilesController {
const { appId, databaseURI, filesAdapter, databaseAdapter, preserveFileName, fileKey } = options;
const {
appId,
databaseURI,
databaseOptions = {},
filesAdapter,
databaseAdapter,
preserveFileName,
fileKey,
} = options;
if (!filesAdapter && databaseAdapter) {
throw 'When using an explicit database adapter, you must also use an explicit filesAdapter.';
}
const filesControllerAdapter = loadAdapter(filesAdapter, () => {
return new GridFSBucketAdapter(databaseURI, {}, fileKey);
return new GridFSBucketAdapter(databaseURI, databaseOptions, fileKey);
});
return new FilesController(filesControllerAdapter, appId, {
preserveFileName,