Subtle renaming of some DB configuration options

pull/612/head
Zef Hemel 2023-12-22 19:06:36 +01:00
parent b3f0c80f91
commit 4015d164c6
2 changed files with 6 additions and 6 deletions

View File

@ -5,16 +5,16 @@ import { path } from "./deps.ts";
/**
* Environment variables:
* - SB_DB_BACKEND: "denokv" or "memory" (default: denokv)
* - SB_KV_DB (denokv only): path to the database file (default .silverbullet.db)
* - SB_DB_BACKEND: "kv" or "memory" (default: kv)
* - SB_KV_DB (kv only): path to the database file (default .silverbullet.db)
*/
export async function determineDatabaseBackend(
singleTenantFolder?: string,
): Promise<KvPrimitives> {
const backendConfig = Deno.env.get("SB_DB_BACKEND") || "denokv";
const backendConfig = Deno.env.get("SB_DB_BACKEND") || "kv";
switch (backendConfig) {
case "denokv": {
case "kv": {
let dbFile: string | undefined = Deno.env.get("SB_KV_DB") ||
".silverbullet.db";
@ -28,7 +28,7 @@ export async function determineDatabaseBackend(
}
const denoDb = await Deno.openKv(dbFile);
console.info(
`Using DenoKV as a database backend (${dbFile || "cloud"}).`,
`Using KV as a database backend (${dbFile || "cloud"}).`,
);
return new DenoKvPrimitives(denoDb);
}

View File

@ -69,7 +69,7 @@ When self-hosting SilverBullet (that is, on any server other than on [[Install/D
KV can be configured as follows:
* `SB_DB_BACKEND`: `denokv` (default, so can be omitted)
* `SB_DB_BACKEND`: `kv` (default, so can be omitted)
* `SB_KV_DB`: path to the file name of the (SQLite) database to store data in, defaults to `.silverbullet.db` in the spaces folder (when kept on disk).
When SilverBullet runs on [[Install/Deno Deploy]] it automatically uses its cloud implementation of KV.