Change environment variable handling
All checks were successful
Build Docker image / build (push) Successful in 1m26s
Build Docker image / deploy (push) Successful in 3s
Build Docker image / verify (push) Successful in 27s

This commit is contained in:
Roman Krček
2025-07-18 10:34:09 +02:00
parent 162a158a85
commit 94e34fbc75
5 changed files with 21 additions and 27 deletions

View File

@@ -1,6 +1,5 @@
import { writable } from 'svelte/store';
const GOOGLE_CLIENT_ID = import.meta.env.VITE_GOOGLE_CLIENT_ID;
import { env } from '$env/dynamic/public';
export const isGoogleApiReady = writable(false);
export const isSignedIn = writable(false);
@@ -45,8 +44,13 @@ export function initGoogleClient(callback: () => void) {
const scriptGsi = document.createElement('script');
scriptGsi.src = 'https://accounts.google.com/gsi/client';
scriptGsi.onload = () => {
const clientId = env.PUBLIC_GOOGLE_CLIENT_ID;
if (!clientId) {
console.error('PUBLIC_GOOGLE_CLIENT_ID is not set in the environment.');
return;
}
tokenClient = google.accounts.oauth2.initTokenClient({
client_id: GOOGLE_CLIENT_ID,
client_id: clientId,
scope: 'https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/spreadsheets.readonly',
callback: (tokenResponse) => {
if (tokenResponse?.access_token) {
@@ -140,7 +144,7 @@ export function extractDriveFileId(url: string): string | null {
];
for (const pattern of patterns) {
const match = url.match(pattern);
const match = pattern.exec(url);
if (match) {
return match[1];
}