Skip to content

Commit 74a757a

Browse files
SamTV12345SamTV12345
and
SamTV12345
authored
Fixed rusty db not found (#743)
Co-authored-by: SamTV12345 <[email protected]>
1 parent 0641272 commit 74a757a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

databases/rusty_db.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import AbstractDatabase from "../lib/AbstractDatabase";
2-
import {KeyValueDB} from "rusty-store-kv";
32

43
export default class Rusty_db extends AbstractDatabase {
5-
db: KeyValueDB | null | undefined
4+
db: any | null | undefined
65

76

87
constructor(settings: {filename: string}) {
@@ -35,7 +34,16 @@ export default class Rusty_db extends AbstractDatabase {
3534
}
3635

3736
async init() {
38-
this.db = new KeyValueDB(this.settings.filename!);
37+
let RUSTY_DB
38+
try {
39+
RUSTY_DB = await import('rusty-store-kv');
40+
} catch (err) {
41+
throw new Error(
42+
'better-sqlite3 not found. It was removed from ueberdb\'s dependencies because it requires ' +
43+
'compilation which fails on several systems. If you still want to use sqlite, run ' +
44+
'"npm install better-sqlite3" in your etherpad-lite ./src directory.');
45+
}
46+
this.db = new RUSTY_DB.KeyValueDB(this.settings.filename!);
3947
}
4048

4149
close() {

databases/sqlite_db.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22
import {BulkObject} from "./cassandra_db";
33
import AbstractDatabase, {Settings} from "../lib/AbstractDatabase";
4-
import SQLITEDB from "better-sqlite3";
54

65
/**
76
* 2011 Peter 'Pita' Martischka

0 commit comments

Comments
 (0)