Skip to content

Commit 3181e8e

Browse files
committed
test: performance improvements, read notes
performance improvements by skipping DNS checks and cloudflare between the webapp and the database locally on the server
1 parent 6f63dff commit 3181e8e

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/hooks.server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { type Handle, redirect } from "@sveltejs/kit"
22
import { createServerClient } from "@supabase/ssr"
33
import { sequence } from "@sveltejs/kit/hooks"
4-
import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY } from "$env/static/public"
4+
import { PUBLIC_SUPABASE_ANON_KEY } from "$env/static/public"
5+
import { LOCAL_SUPABASE_URL } from "$env/static/private"
56

67
const redirects: Handle = async ({ event, resolve }) => {
78
if (event.url.pathname.startsWith("/refresh_token")) {
@@ -20,7 +21,7 @@ const redirects: Handle = async ({ event, resolve }) => {
2021
}
2122

2223
const supabase: Handle = async ({ event, resolve }) => {
23-
event.locals.supabaseServer = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
24+
event.locals.supabaseServer = createServerClient(LOCAL_SUPABASE_URL, PUBLIC_SUPABASE_ANON_KEY, {
2425
cookies: {
2526
getAll: () => event.cookies.getAll(),
2627
setAll: (cookiesToSet) => {

src/lib/components/ScriptCard.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
{#if !script.published}<small class="text-error-500">Unpublished</small>{/if}
4747
</span>
4848
</header>
49-
<article class="my-4 h-full overflow-y-auto text-sm break-words text-surface-600 dark:text-surface-300">
49+
<article
50+
class="my-4 h-full overflow-y-auto text-sm wrap-break-word text-surface-600 dark:text-surface-300"
51+
>
5052
{cropString(script.description, 80)}
5153
</article>
5254
</button>

src/lib/server/supabase.server.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { SUPABASE_SERVICE_KEY } from "$env/static/private"
2-
import { PUBLIC_SUPABASE_URL } from "$env/static/public"
1+
import { LOCAL_SUPABASE_URL, SUPABASE_SERVICE_KEY } from "$env/static/private"
32
import type { Database } from "$lib/types/supabase"
43
import { formatError } from "$lib/utils"
54
import { type SupabaseClient, createClient, type Provider } from "@supabase/supabase-js"
65
import { error, redirect } from "@sveltejs/kit"
76

8-
export const supabaseAdmin = createClient<Database>(PUBLIC_SUPABASE_URL, SUPABASE_SERVICE_KEY, {
7+
export const supabaseAdmin = createClient<Database>(LOCAL_SUPABASE_URL, SUPABASE_SERVICE_KEY, {
98
auth: { autoRefreshToken: true, persistSession: false }
109
})
1110

0 commit comments

Comments
 (0)