Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
johtso committed Apr 7, 2024
1 parent 7605a16 commit cc5e7e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ declare global {
SHOW_INTERNAL_TABLES?: string;
OPENAI_API_KEY?: string;
AI?: unknown;
ACCESS_DOMAIN?: string;
ACCESS_AUD?: string;
} & Record<string, Fetcher | string>;
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { env } from "$env/dynamic/private";
import { DBMS } from "$lib/server/db/dbms";
import type { Handle } from "@sveltejs/kit";
import { locale, waitLocale } from "svelte-i18n";
Expand All @@ -18,12 +17,15 @@ const handler: Handle = async ({ event, resolve }) => {
export const handle: Handle = async ({ event, resolve }) => {
console.log(event.request.url);
// check request is authenticated
if (env.IS_LOCAL_MODE === "1") {
if (event.platform?.env.IS_LOCAL_MODE === "1") {
return await handler({ event, resolve });
} else {
return await onRequest({
request: event.request,
pluginArgs: { domain: env.ACCESS_DOMAIN, aud: env.ACCESS_AUD },
pluginArgs: {
domain: event.platform?.env.ACCESS_DOMAIN,
aud: event.platform?.env.ACCESS_AUD,
},
data: {},
next: async () => {
console.log("authenticated, running handler");
Expand Down

0 comments on commit cc5e7e0

Please sign in to comment.