Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

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

antoine lebaudf85a1efa2969
diff --git a/src/frontend/.env.development b/src/frontend/.env.development
new file mode 100644
index 00000000..1a71fafa
--- /dev/null
+++ b/src/frontend/.env.development
@@ -0,0 +1,2 @@
+VITE_API_BASE_URL=http://localhost:8071/api/v1.0/
+VITE_LIVEKIT_SERVER_URL=http://localhost:7880
diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx
index 52b7a7a8..1ce3cfff 100644
--- a/src/frontend/src/App.tsx
+++ b/src/frontend/src/App.tsx
@@ -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;
diff --git a/src/frontend/src/vite-env.d.ts b/src/frontend/src/vite-env.d.ts
index 11f02fe2..a776d27c 100644
--- a/src/frontend/src/vite-env.d.ts
+++ b/src/frontend/src/vite-env.d.ts
@@ -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;
+}