aboutsummaryrefslogtreecommitdiff
path: root/src/server/database.ts
diff options
context:
space:
mode:
authorTyler Schicke <tschicke@gmail.com>2020-01-07 23:35:14 -0800
committerTyler Schicke <tschicke@gmail.com>2020-01-07 23:57:32 -0800
commit786d25a4f8db1db8795f04a17fba392636e5f891 (patch)
tree6973a067fda8e79a14e70ee8fcd4685752fb0bb0 /src/server/database.ts
parent23d5f6b28a93a3c66c0bd7776d6a42073cc55afb (diff)
Various features/fixes to allow running on Linux w/o MongoDB or Solr
- Added new launch config option for chromium - Changed port for TypeScript server debugger to account for worker process - Updated packages to versions that work with current node/npm - Update IDatabase interface - Updated MemoryDatabase to work properly with Dash - Added some workarounds for in memory database as they currently don't support users, so you must be guest, which means the guest needs to be able to do things it usually can't - Added environment variable to disable search. This doesn't fully disable search yet, but it is enough to not throw major errors when Solr isn't running - Added logic to support using an in memory DB instead of MongoDB
Diffstat (limited to 'src/server/database.ts')
-rw-r--r--src/server/database.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/server/database.ts b/src/server/database.ts
index 3039baedc..83ce865c6 100644
--- a/src/server/database.ts
+++ b/src/server/database.ts
@@ -6,6 +6,7 @@ import { DashUploadUtils } from './DashUploadUtils';
import { Credentials } from 'google-auth-library';
import { GoogleApiServerUtils } from './apis/google/GoogleApiServerUtils';
import { IDatabase } from './IDatabase';
+import { MemoryDatabase } from './MemoryDatabase';
import * as mongoose from 'mongoose';
export namespace Database {
@@ -263,7 +264,16 @@ export namespace Database {
}
}
- export const Instance = new Database();
+ function getDatabase() {
+ switch (process.env.DB) {
+ case "MEM":
+ return new MemoryDatabase();
+ default:
+ return new Database();
+ }
+ }
+
+ export const Instance: IDatabase = getDatabase();
export namespace Auxiliary {