Compare commits

..

4 commits

Author SHA1 Message Date
Christopher (Cris) Fuhrman
4c1f2b4501
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)
2025-01-11 11:33:40 -05:00
C. Fuhrman
afef820765 isDev n'était pas passé en paramètre (undefined) 2025-01-11 11:30:01 -05:00
C. Fuhrman
7c5c6739fa Définir les variables VITE_* (vide)
Vite est censé ne pas les changer par un .env.* (selon copilot)
2025-01-11 11:28:51 -05:00
C. Fuhrman
ec2f6cc358 Renommer .env à .env.development
Vite est censé ignorer ça en production (docker) tandis que .env serait toujours chargé
2025-01-11 11:27:36 -05:00
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);