Add support for portless deploys
This commit is contained in:
1
.env
1
.env
@@ -2,5 +2,6 @@ CLIENT_GRAPH_STEPS=150
|
||||
CLIENT_PORT=3000
|
||||
CLIENT_REFETCH_INTERVAL=500
|
||||
SERVER_ACTIVE_WINDOW=5000
|
||||
SERVER_DEPLOY_URL=
|
||||
SERVER_PORT=3001
|
||||
SERVER_REFRESH_INTERVAL=500
|
||||
@@ -1,6 +1,8 @@
|
||||
# SysMon Web
|
||||
|
||||
A system monitor for the web. Data is read with rust, and displayed on the browser via HTML canvas
|
||||
A system monitor for the web. Data is read with rust, and displayed on the browser via HTML canvas.
|
||||
|
||||
[Live demo](https://sysmon.bate-estacas.xyz/)
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
const getApiUrl = (path: string) => {
|
||||
const url = new URL(window.location.href);
|
||||
let url: URL;
|
||||
try {
|
||||
url = new URL(import.meta.env.SERVER_DEPLOY_URL as string);
|
||||
} catch {
|
||||
url = new URL(window.location.href);
|
||||
url.port = import.meta.env.SERVER_PORT;
|
||||
}
|
||||
|
||||
url.pathname = path;
|
||||
|
||||
return url;
|
||||
|
||||
1
src/client/vite-env.d.ts
vendored
1
src/client/vite-env.d.ts
vendored
@@ -5,6 +5,7 @@ interface ImportMetaEnv {
|
||||
readonly CLIENT_PORT: string;
|
||||
readonly CLIENT_REFETCH_INTERVAL: string;
|
||||
readonly SERVER_ACTIVE_WINDOW: string;
|
||||
readonly SERVER_DEPLOY_URL?: string;
|
||||
readonly SERVER_PORT: string;
|
||||
readonly SERVER_REFRESH_INTERVAL: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user