Checkpoint SHD dashboard design system
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { connect, type Database } from '@tursodatabase/database';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
let databasePromise: Promise<Database> | undefined;
|
||||
|
||||
/**
|
||||
* Returns the process-wide embedded Turso connection.
|
||||
*
|
||||
* This module lives under $lib/server so SvelteKit prevents it from being
|
||||
* imported into browser bundles.
|
||||
*/
|
||||
export function getDatabase(): Promise<Database> {
|
||||
const configuredPath = env.TDR_DATABASE_PATH || './data/shd-build.db';
|
||||
|
||||
if (!databasePromise) {
|
||||
databasePromise = connect(resolve(configuredPath));
|
||||
}
|
||||
|
||||
return databasePromise;
|
||||
}
|
||||
Reference in New Issue
Block a user