diff --git a/Dockerfile b/Dockerfile index fe47d0d..59a10d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,10 @@ COPY . . FROM node:22-alpine WORKDIR /app -# Récupération de la BDD (et autres) depuis Coolify au build -ARG DATABASE_URL +# Récupération de la BDD (et autres) depuis Coolify au build avec valeurs par défaut +ARG DATABASE_URL="file:./dev.db" ENV DATABASE_URL=$DATABASE_URL -ARG PORT +ARG PORT=3001 ENV PORT=$PORT # On ne copie que le nécessaire du builder diff --git a/src/index.ts b/src/index.ts index b44146d..a1266ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,7 +17,7 @@ const app = express(); const httpServer = createServer(app); const io = new Server(httpServer, { cors: { - origin: ["http://localhost:5173"], // Spécifier l'origine pour les credentials + origin: process.env.CORS_ORIGIN ? [process.env.CORS_ORIGIN, "http://localhost:5173"] : ["http://localhost:5173"], // Spécifier l'origine pour les credentials methods: ["GET", "POST", "DELETE", "OPTIONS"], credentials: true } @@ -29,7 +29,7 @@ io.use(socketAuthMiddleware); const logTracker = new LogTracker(io, prisma); app.use(cors({ - origin: "http://localhost:5173", + origin: process.env.CORS_ORIGIN ? [process.env.CORS_ORIGIN, "http://localhost:5173"] : ["http://localhost:5173"], credentials: true })); app.use(express.json());