🔧(frontend) pass API and LiveKit server URLs through environment vars

Configured the frontend to use environment variables (prefixed with "VITE_") for API
and LiveKit server URLs, which will be overridden in the Helm chart values
to ensure correct URLs are used in different environments.
This commit is contained in:
antoine lebaud
2024-07-02 16:22:36 +02:00
parent 5a90ac0a49
commit f85a1efa29
3 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,2 @@
VITE_API_BASE_URL=http://localhost:8071/api/v1.0/
VITE_LIVEKIT_SERVER_URL=http://localhost:7880

View File

@@ -4,8 +4,8 @@ import {LiveKitRoom, VideoConference} from "@livekit/components-react";
import '@livekit/components-styles';
const API_BASE_URL = 'http://localhost:8071/api/v1.0/'
const LIVEKIT_SERVER_URL = 'http://localhost:7880'
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL
const LIVEKIT_SERVER_URL = import.meta.env.VITE_LIVEKIT_SERVER_URL
export interface User {
id: string;

View File

@@ -1 +1,9 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_API_BASE_URL: string;
readonly VITE_LIVEKIT_SERVER_URL: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}