fix: pull env vars from dynamic
All checks were successful
create archive with lfs / tag (push) Successful in 8s

This commit is contained in:
dusk 2024-10-01 04:59:41 +03:00
parent 75dc37835c
commit 5d466eb196
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import type { Cookies } from '@sveltejs/kit'
import { WEBSITE_DATA_DIR } from '$env/static/private'
import { env } from '$env/dynamic/private'
import { existsSync, readFileSync } from 'fs'
import { writable } from 'svelte/store'
@ -17,5 +17,5 @@ export const scopeCookies = (cookies: Cookies, path: string) => {
}
}
export const visitCountFile = `${WEBSITE_DATA_DIR}/visitcount`
export const visitCountFile = `${env.WEBSITE_DATA_DIR}/visitcount`
export const visitCount = writable(parseInt(existsSync(visitCountFile) ? readFileSync(visitCountFile).toString() : '0'));

View File

@ -1,4 +1,4 @@
import { GUESTBOOK_BASE_URL } from '$env/static/private'
import { env } from '$env/dynamic/private'
import { redirect, type Cookies } from '@sveltejs/kit'
import auth from '$lib/guestbookAuth'
import { scopeCookies as _scopeCookies } from '$lib';
@ -90,7 +90,7 @@ export async function load({ url, fetch, cookies }) {
}
// set content, make sure to trim it
postData.set('content', content.substring(0, 512).trim())
respRaw = await fetch(GUESTBOOK_BASE_URL, { method: 'POST', body: postData })
respRaw = await fetch(env.GUESTBOOK_BASE_URL, { method: 'POST', body: postData })
} catch (err: any) {
scopedCookies.set("sendError", `${err.toString()} (is guestbook server running?)`)
redirect(303, auth.callbackUrl)
@ -111,7 +111,7 @@ export async function load({ url, fetch, cookies }) {
try {
const count = 5
const offset = (data.page - 1) * count
respRaw = await fetch(`${GUESTBOOK_BASE_URL}?offset=${offset}&count=${count}`)
respRaw = await fetch(`${env.GUESTBOOK_BASE_URL}?offset=${offset}&count=${count}`)
} catch (err: any) {
data.getError = `${err.toString()} (is guestbook server running?)`
return data