diff --git a/databases/rusty_db.ts b/databases/rusty_db.ts index 724f24af..620249bc 100644 --- a/databases/rusty_db.ts +++ b/databases/rusty_db.ts @@ -1,8 +1,7 @@ import AbstractDatabase from "../lib/AbstractDatabase"; -import {KeyValueDB} from "rusty-store-kv"; export default class Rusty_db extends AbstractDatabase { - db: KeyValueDB | null | undefined + db: any | null | undefined constructor(settings: {filename: string}) { @@ -35,7 +34,16 @@ export default class Rusty_db extends AbstractDatabase { } async init() { - this.db = new KeyValueDB(this.settings.filename!); + let RUSTY_DB + try { + RUSTY_DB = await import('rusty-store-kv'); + } catch (err) { + throw new Error( + 'better-sqlite3 not found. It was removed from ueberdb\'s dependencies because it requires ' + + 'compilation which fails on several systems. If you still want to use sqlite, run ' + + '"npm install better-sqlite3" in your etherpad-lite ./src directory.'); + } + this.db = new RUSTY_DB.KeyValueDB(this.settings.filename!); } close() { diff --git a/databases/sqlite_db.ts b/databases/sqlite_db.ts index 9cdb68ae..452b93be 100644 --- a/databases/sqlite_db.ts +++ b/databases/sqlite_db.ts @@ -1,7 +1,6 @@ 'use strict'; import {BulkObject} from "./cassandra_db"; import AbstractDatabase, {Settings} from "../lib/AbstractDatabase"; -import SQLITEDB from "better-sqlite3"; /** * 2011 Peter 'Pita' Martischka