default daemon url based on hostname
This commit is contained in:
1 parent
81f353c66c
commit
ad2c57f1c0
1 file changed
+5
-6
@@ -13,12 +13,11 @@ function deepClone<T>(v: T): T {
|
||||
}
|
||||
|
||||
// ── Daemon URL ─────────────────────────────────────────────────────────────
|
||||
// Set VITE_DAEMON_URL to connect to live daemon.
|
||||
// Unset → mock mode (dev default).
|
||||
const DAEMON_URL = (import.meta as any).env?.VITE_DAEMON_URL as string | undefined;
|
||||
const WS_URL = DAEMON_URL
|
||||
? DAEMON_URL.replace(/^http/, 'ws') + '/ws'
|
||||
: null;
|
||||
// VITE_DAEMON_URL overrides the default daemon URL to connect to live daemon.
|
||||
// Default: use hostname from current page.
|
||||
const DAEMON_URL = (import.meta as any).env?.VITE_DAEMON_URL as string
|
||||
?? `${window.location.protocol}//${window.location.host}`;
|
||||
const WS_URL = DAEMON_URL.replace(/^http/, 'ws') + '/ws';
|
||||
|
||||
// ── VPD calculation ────────────────────────────────────────────────────────
|
||||
// Vapour Pressure Deficit from temp and RH.
|
||||
|
||||
Reference in new issue
Block a user