This commit is contained in:
Alex Holliday committed 2025-12-10 19:14:07 +00:00
1 parent 8d3d764a0d
commit 0d41e7229b
4 files changed
+20 -14

No files matched your search

-4
View File
@@ -1,4 +0,0 @@
VITE_APP_GLOBAL_REFRESH=UPTIME_APP_GLOBAL_REFRESH
VITE_APP_HOST=UPTIME_APP_HOST
VITE_APP_API_BASE_URL=UPTIME_APP_API_BASE_URL
VITE_APP_DEPLOYMENT_MODE=UPTIME_APP_DEPLOYMENT_MODE
-8
View File
@@ -1,8 +0,0 @@
#!/bin/sh
for i in $(env | grep UPTIME_APP_)
do
key=$(echo $i | cut -d '=' -f 1)
value=$(echo $i | cut -d '=' -f 2-)
echo $key=$value
find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' +
done
+6
View File
@@ -0,0 +1,6 @@
window.__ENV = {
GLOBAL_REFRESH: "60000",
APP_HOST: "http://localhost:5173",
APP_API_BASE_URL: "http://localhost:52345/api/v1",
APP_DEPLOYMENT_MODE: "self_hosted",
};
+14 -2
View File
@@ -1,4 +1,4 @@
import { defineConfig } from "vite";
import { defineConfig, type Plugin } from "vite";
import react from "@vitejs/plugin-react";
import svgr from "vite-plugin-svgr";
import path from "path";
@@ -6,10 +6,22 @@ import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const publicReload = (): Plugin => ({
name: "public-reload",
configureServer(server) {
// Watch all files under public and trigger a full reload on change
server.watcher.add("public/**");
const reload = () => server.ws.send({ type: "full-reload" });
server.watcher.on("add", reload);
server.watcher.on("change", reload);
server.watcher.on("unlink", reload);
},
});
export default defineConfig(() => {
return {
base: "/",
plugins: [svgr(), react()],
plugins: [svgr(), react(), publicReload()],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),