Skip to content

Commit

Permalink
Fixed rusty db not found (#743)
Browse files Browse the repository at this point in the history
Co-authored-by: SamTV12345 <noreply+samtv1235@github.com>
  • Loading branch information
SamTV12345 and SamTV12345 authored Sep 5, 2024
1 parent 0641272 commit 74a757a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 11 additions & 3 deletions databases/rusty_db.ts
Original file line number Diff line number Diff line change
@@ -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}) {
Expand Down Expand Up @@ -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() {
Expand Down
1 change: 0 additions & 1 deletion databases/sqlite_db.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 74a757a

Please sign in to comment.