From 08f7879a0657712235c08b933eff17beba3af2d5 Mon Sep 17 00:00:00 2001 From: zhx Date: Tue, 26 May 2026 16:20:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/gateway-service/configs/config.docker.yaml | 1 + services/gateway-service/configs/config.tencent.example.yaml | 1 + services/gateway-service/configs/config.yaml | 1 + services/gateway-service/internal/config/config.go | 1 + services/gateway-service/internal/config/config_test.go | 4 ++-- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/gateway-service/configs/config.docker.yaml b/services/gateway-service/configs/config.docker.yaml index 35dbfbec..af67244f 100644 --- a/services/gateway-service/configs/config.docker.yaml +++ b/services/gateway-service/configs/config.docker.yaml @@ -17,6 +17,7 @@ cors: - "http://127.0.0.1:5173" - "https://global-interaction.com" - "https://www.global-interaction.com" + - "https://h5.global-interaction.com" - "https://api.global-interaction.com" allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"] allowed_headers: diff --git a/services/gateway-service/configs/config.tencent.example.yaml b/services/gateway-service/configs/config.tencent.example.yaml index 17a2706f..57011b7d 100644 --- a/services/gateway-service/configs/config.tencent.example.yaml +++ b/services/gateway-service/configs/config.tencent.example.yaml @@ -14,6 +14,7 @@ cors: allowed_origins: - "https://global-interaction.com" - "https://www.global-interaction.com" + - "https://h5.global-interaction.com" - "https://api.global-interaction.com" allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"] allowed_headers: diff --git a/services/gateway-service/configs/config.yaml b/services/gateway-service/configs/config.yaml index b83996a1..33b301b6 100644 --- a/services/gateway-service/configs/config.yaml +++ b/services/gateway-service/configs/config.yaml @@ -17,6 +17,7 @@ cors: - "http://127.0.0.1:5173" - "https://global-interaction.com" - "https://www.global-interaction.com" + - "https://h5.global-interaction.com" - "https://api.global-interaction.com" allowed_methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"] allowed_headers: diff --git a/services/gateway-service/internal/config/config.go b/services/gateway-service/internal/config/config.go index 0e330f5d..421a2767 100644 --- a/services/gateway-service/internal/config/config.go +++ b/services/gateway-service/internal/config/config.go @@ -244,6 +244,7 @@ func Default() Config { "http://127.0.0.1:5173", "https://global-interaction.com", "https://www.global-interaction.com", + "https://h5.global-interaction.com", "https://api.global-interaction.com", }, AllowedMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"}, diff --git a/services/gateway-service/internal/config/config_test.go b/services/gateway-service/internal/config/config_test.go index bbc76388..35e639d6 100644 --- a/services/gateway-service/internal/config/config_test.go +++ b/services/gateway-service/internal/config/config_test.go @@ -22,7 +22,7 @@ func TestLoad(t *testing.T) { if cfg.RoomServiceAddr != "127.0.0.1:13001" { t.Fatalf("unexpected room addr: %s", cfg.RoomServiceAddr) } - if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://global-interaction.com") || !containsString(cfg.CORS.AllowedHeaders, "X-App-Code") { + if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://h5.global-interaction.com") || !containsString(cfg.CORS.AllowedHeaders, "X-App-Code") { t.Fatalf("unexpected cors config: %+v", cfg.CORS) } if cfg.GRPCClient.DefaultTimeout != 5*time.Second || cfg.GRPCClient.RetryMaxAttempts != 2 || len(cfg.GRPCClient.RetryableStatusCodes) != 1 || cfg.GRPCClient.RetryableStatusCodes[0] != "UNAVAILABLE" { @@ -67,7 +67,7 @@ func TestLoadTencentExample(t *testing.T) { if cfg.TencentIM.CallbackURL == "" { t.Fatalf("callback_url template must be present") } - if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://global-interaction.com") || cfg.CORS.MaxAgeSec != 600 { + if !cfg.CORS.Enabled || !containsString(cfg.CORS.AllowedOrigins, "https://h5.global-interaction.com") || cfg.CORS.MaxAgeSec != 600 { t.Fatalf("tencent cors template must be explicit: %+v", cfg.CORS) } if cfg.AppConfig.MySQLDSN == "" || !strings.Contains(cfg.AppConfig.MySQLDSN, "hyapp_admin") {