env variables handling

This commit is contained in:
cpu
2025-03-31 01:26:50 +02:00
parent c2e7bd5f1e
commit 51a1be22d2
15 changed files with 209 additions and 106 deletions

View File

@@ -4,7 +4,6 @@ import * as state from './core/state.js';
import * as ui from './ui/ui.js';
import * as timer from './core/timer.js';
import camera from './ui/camera.js'; // Default export
import { initEnv } from './env-loader.js';
import * as pushSettingsUI from './ui/pushSettingsUI.js'; // Import the new push settings UI module
// Import externalized modules
@@ -21,8 +20,13 @@ async function initialize() {
// 0. Wait for environment variables to load
try {
await initEnv();
console.log("Environment variables loaded");
// Use the ensureEnvLoaded function from config.js to make sure environment variables are loaded
await config.ensureEnvLoaded();
console.log("Environment variables loaded and verified");
// Log the loaded environment variables for debugging
console.log("BACKEND_URL:", config.getBackendUrl());
console.log("PUBLIC_VAPID_KEY:", config.getPublicVapidKey());
} catch (error) {
console.warn("Failed to load environment variables, using defaults:", error);
}