merge two server hook files
This commit is contained in:
parent
bc0782987a
commit
c943408a89
@ -1,5 +1,15 @@
|
|||||||
import type { Handle } from '@sveltejs/kit';
|
import type { Handle } from '@sveltejs/kit';
|
||||||
import * as auth from '$lib/server/auth.js';
|
import * as auth from '$lib/server/auth.js';
|
||||||
|
import { dev } from '$app/environment';
|
||||||
|
import { db } from '$lib/server/db';
|
||||||
|
import type { ServerInit } from '@sveltejs/kit';
|
||||||
|
import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
|
||||||
|
|
||||||
|
export const init: ServerInit = async () => {
|
||||||
|
if (!dev) {
|
||||||
|
await migrate(db, { migrationsFolder: './drizzle' });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleAuth: Handle = async ({ event, resolve }) => {
|
const handleAuth: Handle = async ({ event, resolve }) => {
|
||||||
const sessionToken = event.cookies.get(auth.sessionCookieName);
|
const sessionToken = event.cookies.get(auth.sessionCookieName);
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
import { dev } from '$app/environment';
|
|
||||||
import { db } from '$lib/server/db';
|
|
||||||
import type { ServerInit } from '@sveltejs/kit';
|
|
||||||
import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
|
|
||||||
|
|
||||||
export const init: ServerInit = async () => {
|
|
||||||
if (!dev) {
|
|
||||||
await migrate(db, { migrationsFolder: './drizzle' });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Loading…
Reference in New Issue
Block a user