From e9a4ebca38a7ade824806973d0259657e3269904 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Thu, 21 Sep 2017 22:17:55 +0200 Subject: [PATCH] [Hotfix] Fix bug while reading Nedb option inMemoryOnly --- src/server/lib/ServerVariablesHandler.ts | 6 +++--- src/server/lib/storage/CollectionFactoryFactory.ts | 4 ++-- src/server/lib/storage/nedb/NedbCollectionFactory.ts | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/server/lib/ServerVariablesHandler.ts b/src/server/lib/ServerVariablesHandler.ts index e16172c78..ce40b4a49 100644 --- a/src/server/lib/ServerVariablesHandler.ts +++ b/src/server/lib/ServerVariablesHandler.ts @@ -49,9 +49,9 @@ export interface ServerVariables { class UserDataStoreFactory { static create(config: Configuration.AppConfiguration): BluebirdPromise { if (config.storage.local) { - const nedbOptions = { - directory: config.storage.local.path, - inMemory: config.storage.local.in_memory + const nedbOptions: Nedb.DataStoreOptions = { + filename: config.storage.local.path, + inMemoryOnly: config.storage.local.in_memory }; const collectionFactory = CollectionFactoryFactory.createNedb(nedbOptions); return BluebirdPromise.resolve(new UserDataStore(collectionFactory)); diff --git a/src/server/lib/storage/CollectionFactoryFactory.ts b/src/server/lib/storage/CollectionFactoryFactory.ts index e5781ed36..92b29abfa 100644 --- a/src/server/lib/storage/CollectionFactoryFactory.ts +++ b/src/server/lib/storage/CollectionFactoryFactory.ts @@ -1,11 +1,11 @@ import { ICollectionFactory } from "./ICollectionFactory"; -import { NedbCollectionFactory, NedbOptions } from "./nedb/NedbCollectionFactory"; +import { NedbCollectionFactory } from "./nedb/NedbCollectionFactory"; import { MongoCollectionFactory } from "./mongo/MongoCollectionFactory"; import { IMongoClient } from "../connectors/mongo/IMongoClient"; export class CollectionFactoryFactory { - static createNedb(options: NedbOptions): ICollectionFactory { + static createNedb(options: Nedb.DataStoreOptions): ICollectionFactory { return new NedbCollectionFactory(options); } diff --git a/src/server/lib/storage/nedb/NedbCollectionFactory.ts b/src/server/lib/storage/nedb/NedbCollectionFactory.ts index ca660c9f0..49c4dc853 100644 --- a/src/server/lib/storage/nedb/NedbCollectionFactory.ts +++ b/src/server/lib/storage/nedb/NedbCollectionFactory.ts @@ -10,17 +10,17 @@ export interface NedbOptions { } export class NedbCollectionFactory implements ICollectionFactory { - private options: NedbOptions; + private options: Nedb.DataStoreOptions; - constructor(options: NedbOptions) { + constructor(options: Nedb.DataStoreOptions) { this.options = options; } build(collectionName: string): ICollection { - const datastoreOptions = { + const datastoreOptions: Nedb.DataStoreOptions = { inMemoryOnly: this.options.inMemoryOnly || false, autoload: true, - filename: (this.options.directory) ? path.resolve(this.options.directory, collectionName) : undefined + filename: (this.options.filename) ? path.resolve(this.options.filename, collectionName) : undefined }; return new NedbCollection(datastoreOptions);