From 06d76438e8a4eb2e9d88fac179c2a33cf110aa28 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 29 Sep 2025 16:04:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=89=8D=E7=AB=AF=E5=88=9D=E6=AD=A5?= =?UTF-8?q?=E8=B0=83=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 10 ++++++---- .../main/java/com/openisle/config/SecurityConfig.java | 2 ++ docker/docker-compose.yaml | 4 ---- frontend_nuxt/nuxt.config.ts | 4 +++- .../openisle/websocket/security/SecurityConfig.java | 2 ++ 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 5a2bbdcb6..887a948b2 100644 --- a/.env.example +++ b/.env.example @@ -15,20 +15,21 @@ OPENSEARCH_ENABLED=true OPENSEARCH_SCHEME=http OPENSEARCH_USERNAME= OPENSEARCH_PASSWORD= +OPENSEARCH_HOST=opensearch # === Database Configuration === MYSQL_DATABASE=openisle MYSQL_ROOT_PASSWORD= MYSQL_USER= MYSQL_PASSWORD= -MYSQL_HOST=localhost +MYSQL_HOST=mysql # === Redis Configuration === REDIS_HOST=redis REDIS_DATABASE=0 # === RabbitMQ Configuration === -RABBITMQ_HOST=local +RABBITMQ_HOST=rabbitmq RABBITMQ_USERNAME=guest RABBITMQ_PASSWORD=guest @@ -79,8 +80,9 @@ WEBPUSH_PRIVATE_KEY= LOG_LEVEL=INFO # === Frontend (Nuxt) === -NUXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8080 -NUXT_PUBLIC_WEBSOCKET_URL=https://127.0.0.1:8082 +NUXT_PUBLIC_API_BASE_URL=http://springboot:8080 +NUXT_PUBLIC_API_BASE_URL_SSR=http://localhost:8080 +NUXT_PUBLIC_WEBSOCKET_URL=http://websocket_service:8082 NUXT_PUBLIC_WEBSITE_BASE_URL=http://localhost:3000 # 线上 & 本地均可使用 NUXT_PUBLIC_GOOGLE_CLIENT_ID=777830451304-nt8afkkap18gui4f9entcha99unal744.apps.googleusercontent.com diff --git a/backend/src/main/java/com/openisle/config/SecurityConfig.java b/backend/src/main/java/com/openisle/config/SecurityConfig.java index 4bd8e735f..b2d0da85e 100644 --- a/backend/src/main/java/com/openisle/config/SecurityConfig.java +++ b/backend/src/main/java/com/openisle/config/SecurityConfig.java @@ -97,6 +97,8 @@ public class SecurityConfig { "http://localhost:8081", "http://localhost:8082", "http://localhost:3000", + "http://frontend_dev:3000", + "http://frontend_service:3000", "http://localhost:3001", "http://localhost", "http://30.211.97.238:3000", diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 178a74536..2f82594ee 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -101,10 +101,6 @@ services: working_dir: /app env_file: - ../.env - environment: - - MYSQL_HOST=mysql - - OPENSEARCH_HOST=opensearch - - RABBITMQ_HOST=rabbitmq ports: - "${SERVER_PORT:-8080}:${SERVER_PORT:-8080}" volumes: diff --git a/frontend_nuxt/nuxt.config.ts b/frontend_nuxt/nuxt.config.ts index 0c5bea8ac..b2c7784b7 100644 --- a/frontend_nuxt/nuxt.config.ts +++ b/frontend_nuxt/nuxt.config.ts @@ -9,7 +9,9 @@ export default defineNuxtConfig({ modules: ['@nuxt/image'], runtimeConfig: { public: { - apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL || '', + apiBaseUrl: process.server + ? process.env.NUXT_PUBLIC_API_BASE_URL_SSR + : process.env.NUXT_PUBLIC_API_BASE_URL, websocketUrl: process.env.NUXT_PUBLIC_WEBSOCKET_URL || '', websiteBaseUrl: process.env.NUXT_PUBLIC_WEBSITE_BASE_URL || '', googleClientId: process.env.NUXT_PUBLIC_GOOGLE_CLIENT_ID || '', diff --git a/websocket_service/src/main/java/com/openisle/websocket/security/SecurityConfig.java b/websocket_service/src/main/java/com/openisle/websocket/security/SecurityConfig.java index 06b924bd8..6d6da7faa 100644 --- a/websocket_service/src/main/java/com/openisle/websocket/security/SecurityConfig.java +++ b/websocket_service/src/main/java/com/openisle/websocket/security/SecurityConfig.java @@ -37,6 +37,8 @@ public class SecurityConfig { "http://localhost:8081", "http://localhost:8082", "http://localhost:3000", + "http://frontend_dev:3000", + "http://frontend_service:3000", "http://localhost:3001", "http://localhost", "http://30.211.97.238:3000",