Merge pull request #188 from ets-cfuhrman-pfe/fuhrmanator/issue187
Some checks failed
CI/CD Pipeline for Backend / build_and_push_backend (push) Has been cancelled
CI/CD Pipeline for Nginx Router / build_and_push_nginx (push) Has been cancelled
CI/CD Pipeline for Frontend / build_and_push_frontend (push) Has been cancelled
Tests / tests (client) (push) Has been cancelled
Tests / tests (server) (push) Has been cancelled

Corriger la config des variables d'environnement development/production (docker)
This commit is contained in:
Christopher (Cris) Fuhrman 2025-01-11 11:33:40 -05:00 committed by GitHub
commit 4c1f2b4501
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -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:

View file

@ -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);