larsen/plice/src/hooks.server.ts
Roman Godmaire 054e3635f3 feat: switch to local filestore
The plan is to adopt a sidecar model where files are written to disk
then transcoded by a sidecar written in rust where they will then be
written to another location (ie. Backblaze B2, S3, NFS)
2024-02-10 14:44:10 -05:00

22 lines
654 B
TypeScript

import type { Handle } from '@sveltejs/kit';
import { env } from '$env/dynamic/private';
import { auth } from '$lib/server/lucia';
import { LocalFileStore } from '$lib/server/storage/local';
import { DatabasePrisma } from '$lib/server/db/prisma';
const localFileStore = new LocalFileStore(env.FILE_BASE_PATH, env.FILE_EXTENSION);
const prismaClient = new DatabasePrisma(env.DATABASE_URL);
export const handle: Handle = async ({ event, resolve }) => {
event.locals = {
auth,
authReq: auth.handleRequest(event),
database: prismaClient,
writeStore: localFileStore,
readStore: localFileStore
};
return await resolve(event);
};