Subtle renaming of some DB configuration options
parent
b3f0c80f91
commit
4015d164c6
|
@ -5,16 +5,16 @@ import { path } from "./deps.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Environment variables:
|
* Environment variables:
|
||||||
* - SB_DB_BACKEND: "denokv" or "memory" (default: denokv)
|
* - SB_DB_BACKEND: "kv" or "memory" (default: kv)
|
||||||
* - SB_KV_DB (denokv only): path to the database file (default .silverbullet.db)
|
* - SB_KV_DB (kv only): path to the database file (default .silverbullet.db)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export async function determineDatabaseBackend(
|
export async function determineDatabaseBackend(
|
||||||
singleTenantFolder?: string,
|
singleTenantFolder?: string,
|
||||||
): Promise<KvPrimitives> {
|
): Promise<KvPrimitives> {
|
||||||
const backendConfig = Deno.env.get("SB_DB_BACKEND") || "denokv";
|
const backendConfig = Deno.env.get("SB_DB_BACKEND") || "kv";
|
||||||
switch (backendConfig) {
|
switch (backendConfig) {
|
||||||
case "denokv": {
|
case "kv": {
|
||||||
let dbFile: string | undefined = Deno.env.get("SB_KV_DB") ||
|
let dbFile: string | undefined = Deno.env.get("SB_KV_DB") ||
|
||||||
".silverbullet.db";
|
".silverbullet.db";
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export async function determineDatabaseBackend(
|
||||||
}
|
}
|
||||||
const denoDb = await Deno.openKv(dbFile);
|
const denoDb = await Deno.openKv(dbFile);
|
||||||
console.info(
|
console.info(
|
||||||
`Using DenoKV as a database backend (${dbFile || "cloud"}).`,
|
`Using KV as a database backend (${dbFile || "cloud"}).`,
|
||||||
);
|
);
|
||||||
return new DenoKvPrimitives(denoDb);
|
return new DenoKvPrimitives(denoDb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ When self-hosting SilverBullet (that is, on any server other than on [[Install/D
|
||||||
|
|
||||||
KV can be configured as follows:
|
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 space’s folder (when kept on disk).
|
* `SB_KV_DB`: path to the file name of the (SQLite) database to store data in, defaults to `.silverbullet.db` in the space’s folder (when kept on disk).
|
||||||
|
|
||||||
When SilverBullet runs on [[Install/Deno Deploy]] it automatically uses its cloud implementation of KV.
|
When SilverBullet runs on [[Install/Deno Deploy]] it automatically uses its cloud implementation of KV.
|
||||||
|
|
Loading…
Reference in New Issue