[Hotfix] Fix bug while reading Nedb option inMemoryOnly
parent
9ac2c808ec
commit
e9a4ebca38
|
@ -49,9 +49,9 @@ export interface ServerVariables {
|
|||
class UserDataStoreFactory {
|
||||
static create(config: Configuration.AppConfiguration): BluebirdPromise<UserDataStore> {
|
||||
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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue