From 870e84b539d072c2c317585ab2826850143fb958 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 19 May 2025 15:04:58 -0700 Subject: [PATCH] add env vars --- docker/dist-mono/docker-compose.yaml | 5 +++-- server/index.js | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docker/dist-mono/docker-compose.yaml b/docker/dist-mono/docker-compose.yaml index 204881d4a..ae4ac7569 100755 --- a/docker/dist-mono/docker-compose.yaml +++ b/docker/dist-mono/docker-compose.yaml @@ -4,8 +4,9 @@ services: restart: always ports: - "52345:52345" - env_file: - - server.env + environment: + - UPTIME_APP_API_BASE_URL=http://localhost:52345/api/v1 + - UPTIME_APP_CLIENT_HOST=http://localhost depends_on: - redis - mongodb diff --git a/server/index.js b/server/index.js index 85ad2a31d..b101c7bff 100755 --- a/server/index.js +++ b/server/index.js @@ -99,6 +99,8 @@ const openApiSpec = JSON.parse( fs.readFileSync(path.join(__dirname, "openapi.json"), "utf8") ); +const frontendPath = path.join(__dirname, "public"); + let server; const shutdown = async () => { @@ -308,6 +310,7 @@ const startApp = async () => { const notificationRoutes = new NotificationRoutes(notificationController); const diagnosticRoutes = new DiagnosticRoutes(diagnosticController); // Middleware + app.use(express.static(frontendPath)); app.use(responseHandler); app.use( cors({ @@ -353,6 +356,10 @@ const startApp = async () => { status: "OK", }); }); + // FE routes + app.get("*", (req, res) => { + res.sendFile(path.join(frontendPath, "index.html")); + }); app.use(handleErrors); };