From 9777b467770f43d51f5389baa3919c999836411a Mon Sep 17 00:00:00 2001 From: boratsc Date: Mon, 21 Jul 2025 00:58:17 +0200 Subject: [PATCH] poprawki dla dev --- bot/backend/web/server.js | 18 +++++++++++------- bot/docker-compose.dev.yml | 6 ++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bot/backend/web/server.js b/bot/backend/web/server.js index 9639847..46962fc 100644 --- a/bot/backend/web/server.js +++ b/bot/backend/web/server.js @@ -34,7 +34,7 @@ class WebPanel { this.app.use(cors({ origin: process.env.NODE_ENV === 'production' ? ['https://your-domain.com'] - : ['http://localhost:3001', 'http://127.0.0.1:3001'], + : ['http://localhost:3001', 'http://127.0.0.1:3001', 'http://localhost:3000'], credentials: true })); @@ -44,8 +44,10 @@ class WebPanel { this.app.use(express.json({ limit: '10mb' })); this.app.use(express.urlencoded({ extended: true, limit: '10mb' })); - // Serwowanie plików statycznych (dla built React app) - this.app.use(express.static('frontend/build')); + // Serwowanie plików statycznych tylko w production + if (process.env.NODE_ENV === 'production') { + this.app.use(express.static('frontend/build')); + } } setupRoutes() { @@ -63,10 +65,12 @@ class WebPanel { }); }); - // Catch all handler dla React Router - this.app.get('*', (req, res) => { - res.sendFile('index.html', { root: 'frontend/build' }); - }); + // Catch all handler dla React Router - tylko w production + if (process.env.NODE_ENV === 'production') { + this.app.get('*', (req, res) => { + res.sendFile('index.html', { root: 'frontend/build' }); + }); + } // Error handler this.app.use(this.errorHandler.bind(this)); diff --git a/bot/docker-compose.dev.yml b/bot/docker-compose.dev.yml index 0e77a07..8e24084 100644 --- a/bot/docker-compose.dev.yml +++ b/bot/docker-compose.dev.yml @@ -67,11 +67,9 @@ services: SESSION_SECRET: dev_session_secret_key WEB_PORT: 3001 API_PORT: 3000 - + # OAuth2 - OAUTH2_REDIRECT_URI: http://localhost:3001/auth/discord/callback - - # Environment + OAUTH2_REDIRECT_URI: http://localhost:3001/auth/discord/callback # Environment NODE_ENV: development LOG_LEVEL: debug