diff --git a/client/.env b/client/.env.development similarity index 100% rename from client/.env rename to client/.env.development diff --git a/docker-compose.yaml b/docker-compose.yaml index 97c112f..184857f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,12 +3,13 @@ services: frontend: image: fuhrmanator/evaluetonsavoir-frontend:latest container_name: frontend + environment: + # Define empty VITE_BACKEND_URL because it's production + - VITE_BACKEND_URL= + # Define empty VITE_BACKEND_SOCKET_URL so it will default to window.location.host + - VITE_BACKEND_SOCKET_URL= ports: - "5173:5173" - environment: - VITE_BACKEND_URL: "http://localhost:4400" - # don't define VITE_BACKEND_SOCKET_URL so it will default to window.location.host - # VITE_BACKEND_SOCKET_URL: "" restart: always backend: diff --git a/server/app.js b/server/app.js index 4616014..570ee8b 100644 --- a/server/app.js +++ b/server/app.js @@ -52,6 +52,7 @@ const cors = require("cors"); const bodyParser = require('body-parser'); const configureServer = (httpServer, isDev) => { + console.log(`Configuring server with isDev: ${isDev}`); return new Server(httpServer, { path: "/socket.io", cors: { @@ -68,7 +69,7 @@ const server = http.createServer(app); console.log(`Environnement: ${process.env.NODE_ENV} (${isDev ? 'dev' : 'prod'})`); -const io = configureServer(server); +const io = configureServer(server, isDev); console.log(`Server configured with cors.origin: ${io.opts.cors.origin} and secure: ${io.opts.secure}`); setupWebsocket(io);