feat: ci/cd flow
This commit is contained in:
+17
-2
@@ -1,12 +1,27 @@
|
||||
import { type Handle, redirect } from '@sveltejs/kit';
|
||||
import { type Handle, redirect, type ServerInit } from '@sveltejs/kit';
|
||||
import { sequence } from '@sveltejs/kit/hooks';
|
||||
import { building, dev } from '$app/environment';
|
||||
import { getAuth } from '$lib/auth/server';
|
||||
import { getConfig } from '$lib/server/config';
|
||||
import { getTextDirection } from '$lib/paraglide/runtime';
|
||||
import { paraglideMiddleware } from '$lib/paraglide/server';
|
||||
import { getConfig } from '$lib/server/config';
|
||||
import { svelteKitHandler } from 'better-auth/svelte-kit';
|
||||
|
||||
export const init: ServerInit = () => {
|
||||
const env = process.env;
|
||||
const errors: string[] = [];
|
||||
|
||||
for (const key of ['CRYPTO_SECRET', 'BETTER_AUTH_SECRET', 'REPOSITORY_URL'])
|
||||
if (!env[key]?.trim()) errors.push(`${key} is missing`);
|
||||
|
||||
for (const key of ['CRYPTO_SECRET', 'BETTER_AUTH_SECRET'])
|
||||
if (env[key] && env[key]!.length < 32)
|
||||
errors.push(`${key} is too short (need >= 32 chars; openssl rand -base64 32)`);
|
||||
|
||||
if (errors.length)
|
||||
throw new Error(`Invalid environment:\n - ${errors.join('\n - ')}`);
|
||||
};
|
||||
|
||||
const handleBetterAuth: Handle = async ({ event, resolve }) => {
|
||||
const cfg = getConfig();
|
||||
const auth = getAuth();
|
||||
|
||||
Reference in New Issue
Block a user