新增多个模块和功能,包括用户评论、帖子、WebSocket通信优化及日志配置,更新文档和部署脚本,提升项目整体性能和可维护性。
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.emotionmuseum.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* 网关服务启动类
|
||||
*
|
||||
* @author emotion-museum
|
||||
* @since 2025-07-12
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class GatewayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GatewayApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.emotionmuseum.gateway.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.reactive.CorsWebFilter;
|
||||
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
|
||||
|
||||
/**
|
||||
* CORS配置
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public CorsWebFilter corsWebFilter() {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
|
||||
// 允许所有来源
|
||||
corsConfiguration.addAllowedOriginPattern("*");
|
||||
|
||||
// 允许所有请求头
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
|
||||
// 允许所有请求方法
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
|
||||
// 不允许携带凭证(这样就可以使用 * 作为来源)
|
||||
corsConfiguration.setAllowCredentials(false);
|
||||
|
||||
// 预检请求的缓存时间
|
||||
corsConfiguration.setMaxAge(3600L);
|
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", corsConfiguration);
|
||||
|
||||
return new CorsWebFilter(source);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
# Gateway Docker环境配置
|
||||
server:
|
||||
port: 9000
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: emotion-gateway
|
||||
profiles:
|
||||
active: docker
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS_SERVER_ADDR:nacos:8848}
|
||||
namespace: public
|
||||
group: DEFAULT_GROUP
|
||||
config:
|
||||
server-addr: ${NACOS_SERVER_ADDR:nacos:8848}
|
||||
file-extension: yml
|
||||
namespace: public
|
||||
group: DEFAULT_GROUP
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
# AI服务路由
|
||||
- id: emotion-ai
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/api/ai/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 用户服务路由
|
||||
- id: emotion-user
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/api/user/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 记录服务路由
|
||||
- id: emotion-record
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/api/record/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 成长服务路由
|
||||
- id: emotion-growth
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/api/growth/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 探索服务路由
|
||||
- id: emotion-explore
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/api/explore/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 奖励服务路由
|
||||
- id: emotion-reward
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/api/reward/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
# 统计服务路由
|
||||
- id: emotion-stats
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/api/stats/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowedOriginPatterns: "*"
|
||||
allowedMethods: "*"
|
||||
allowedHeaders: "*"
|
||||
allowCredentials: true
|
||||
|
||||
# 数据源配置
|
||||
datasource:
|
||||
url: jdbc:mysql://${MYSQL_HOST:mysql}:${MYSQL_PORT:3306}/emotion_museum?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: 123456
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
# Redis配置
|
||||
redis:
|
||||
host: ${REDIS_HOST:redis}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password:
|
||||
database: 0
|
||||
timeout: 6000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.emotionmuseum: DEBUG
|
||||
org.springframework.cloud.gateway: DEBUG
|
||||
pattern:
|
||||
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level [%logger{50}] - %msg%n"
|
||||
|
||||
# 管理端点
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
@@ -0,0 +1,143 @@
|
||||
# 本地开发环境配置
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: localhost:8848
|
||||
namespace:
|
||||
group: DEFAULT_GROUP
|
||||
enabled: true
|
||||
username: nacos
|
||||
password: Peanut2817*#
|
||||
metadata:
|
||||
version: 1.0.0
|
||||
zone: local
|
||||
register-enabled: true
|
||||
ephemeral: true
|
||||
cluster-name: DEFAULT
|
||||
service: ${spring.application.name}
|
||||
weight: 1
|
||||
heart-beat-interval: 5000
|
||||
heart-beat-timeout: 15000
|
||||
ip-delete-timeout: 30000
|
||||
config:
|
||||
server-addr: localhost:8848
|
||||
namespace:
|
||||
group: DEFAULT_GROUP
|
||||
file-extension: yml
|
||||
enabled: false
|
||||
username: nacos
|
||||
password: Peanut2817*#
|
||||
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
|
||||
routes:
|
||||
# 用户服务路由 (包含认证功能)
|
||||
- id: emotion-user-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/user/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 验证码服务路由
|
||||
- id: emotion-captcha-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/captcha/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# OAuth服务路由
|
||||
- id: emotion-oauth-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/oauth/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# AI服务路由
|
||||
- id: emotion-ai-route
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由
|
||||
- id: emotion-websocket-route
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/websocket/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# WebSocket连接路由 (支持WebSocket升级)
|
||||
- id: emotion-websocket-ws-route
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/ws/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 情绪记录服务路由
|
||||
- id: emotion-record-route
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/record/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 成长课题服务路由
|
||||
- id: emotion-growth-route
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/growth/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 地图探索服务路由
|
||||
- id: emotion-explore-route
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/explore/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 成就奖励服务路由
|
||||
- id: emotion-reward-route
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/reward/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 统计分析服务路由
|
||||
- id: emotion-stats-route
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/stats/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# Redis配置
|
||||
data:
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
password:
|
||||
database: 0
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.emotionmuseum: debug
|
||||
org.springframework.cloud.gateway: debug
|
||||
org.springframework.web: debug
|
||||
file:
|
||||
name: logs/emotion-gateway-local.log
|
||||
@@ -0,0 +1,144 @@
|
||||
# 生产环境配置
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 47.111.10.27:8848
|
||||
namespace: prod
|
||||
group: DEFAULT_GROUP
|
||||
enabled: true
|
||||
username: nacos
|
||||
password: EmotionMuseum2025
|
||||
metadata:
|
||||
version: 1.0.0
|
||||
zone: prod
|
||||
register-enabled: true
|
||||
ephemeral: true
|
||||
cluster-name: DEFAULT
|
||||
service: ${spring.application.name}
|
||||
weight: 1
|
||||
heart-beat-interval: 5000
|
||||
heart-beat-timeout: 15000
|
||||
ip-delete-timeout: 30000
|
||||
config:
|
||||
server-addr: 47.111.10.27:8848
|
||||
namespace: prod
|
||||
group: DEFAULT_GROUP
|
||||
file-extension: yml
|
||||
enabled: false
|
||||
username: nacos
|
||||
password: EmotionMuseum2025
|
||||
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
|
||||
routes:
|
||||
# 用户服务路由 (包含认证功能)
|
||||
- id: emotion-user-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/user/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 验证码服务路由
|
||||
- id: emotion-captcha-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/captcha/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# OAuth服务路由
|
||||
- id: emotion-oauth-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/oauth/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# AI服务路由
|
||||
- id: emotion-ai-route
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由
|
||||
- id: emotion-websocket-route
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/websocket/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# WebSocket连接路由 (支持WebSocket升级)
|
||||
- id: emotion-websocket-ws-route
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/ws/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 情绪记录服务路由
|
||||
- id: emotion-record-route
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/record/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 成长课题服务路由
|
||||
- id: emotion-growth-route
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/growth/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 地图探索服务路由
|
||||
- id: emotion-explore-route
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/explore/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 成就奖励服务路由
|
||||
- id: emotion-reward-route
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/reward/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 统计分析服务路由
|
||||
- id: emotion-stats-route
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/stats/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# Redis配置
|
||||
data:
|
||||
redis:
|
||||
host: 47.111.10.27
|
||||
port: 6379
|
||||
password: EmotionMuseum2025*#
|
||||
database: 0
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.emotionmuseum: warn
|
||||
org.springframework.cloud.gateway: warn
|
||||
org.springframework.web: warn
|
||||
com.alibaba.nacos: error
|
||||
file:
|
||||
name: logs/emotion-gateway-prod.log
|
||||
@@ -0,0 +1,144 @@
|
||||
# 测试环境配置
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 47.111.10.27:8848
|
||||
namespace: test
|
||||
group: DEFAULT_GROUP
|
||||
enabled: true
|
||||
username: nacos
|
||||
password: EmotionMuseum2025
|
||||
metadata:
|
||||
version: 1.0.0
|
||||
zone: test
|
||||
register-enabled: true
|
||||
ephemeral: true
|
||||
cluster-name: DEFAULT
|
||||
service: ${spring.application.name}
|
||||
weight: 1
|
||||
heart-beat-interval: 5000
|
||||
heart-beat-timeout: 15000
|
||||
ip-delete-timeout: 30000
|
||||
config:
|
||||
server-addr: 47.111.10.27:8848
|
||||
namespace: test
|
||||
group: DEFAULT_GROUP
|
||||
file-extension: yml
|
||||
enabled: false
|
||||
username: nacos
|
||||
password: EmotionMuseum2025
|
||||
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
|
||||
routes:
|
||||
# 用户服务路由 (包含认证功能)
|
||||
- id: emotion-user-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/user/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 验证码服务路由
|
||||
- id: emotion-captcha-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/captcha/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# OAuth服务路由
|
||||
- id: emotion-oauth-route
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/oauth/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# AI服务路由
|
||||
- id: emotion-ai-route
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由
|
||||
- id: emotion-websocket-route
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/websocket/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# WebSocket连接路由 (支持WebSocket升级)
|
||||
- id: emotion-websocket-ws-route
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/ws/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 情绪记录服务路由
|
||||
- id: emotion-record-route
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/record/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 成长课题服务路由
|
||||
- id: emotion-growth-route
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/growth/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 地图探索服务路由
|
||||
- id: emotion-explore-route
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/explore/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 成就奖励服务路由
|
||||
- id: emotion-reward-route
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/reward/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# 统计分析服务路由
|
||||
- id: emotion-stats-route
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/stats/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
|
||||
# Redis配置
|
||||
data:
|
||||
redis:
|
||||
host: 47.111.10.27
|
||||
port: 6379
|
||||
password: EmotionMuseum2025*#
|
||||
database: 0
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.emotionmuseum: info
|
||||
org.springframework.cloud.gateway: info
|
||||
org.springframework.web: info
|
||||
com.alibaba.nacos: warn
|
||||
file:
|
||||
name: logs/emotion-gateway-test.log
|
||||
@@ -0,0 +1,242 @@
|
||||
server:
|
||||
port: 19000
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: emotion-gateway
|
||||
|
||||
# 配置文件激活
|
||||
profiles:
|
||||
active: ${SPRING_PROFILES_ACTIVE:local}
|
||||
|
||||
# 允许Bean覆盖和循环引用
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
allow-circular-references: true
|
||||
|
||||
# 排除数据库自动配置
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
|
||||
- org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
|
||||
- com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration
|
||||
|
||||
# Redis配置
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
database: 0
|
||||
timeout: 10000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
# 网关和Nacos配置
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:localhost}:${NACOS_PORT:8848}
|
||||
namespace: ${NACOS_NAMESPACE:}
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
enabled: ${NACOS_DISCOVERY_ENABLED:true}
|
||||
username: ${NACOS_USERNAME:nacos}
|
||||
password: ${NACOS_PASSWORD:nacos}
|
||||
metadata:
|
||||
version: 1.0.0
|
||||
zone: ${NACOS_ZONE:default}
|
||||
config:
|
||||
server-addr: ${NACOS_HOST:localhost}:${NACOS_PORT:8848}
|
||||
namespace: ${NACOS_NAMESPACE:}
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
file-extension: yml
|
||||
enabled: ${NACOS_CONFIG_ENABLED:false}
|
||||
username: ${NACOS_USERNAME:nacos}
|
||||
password: ${NACOS_PASSWORD:nacos}
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
# 认证服务路由 - API路径
|
||||
- id: emotion-auth-api
|
||||
uri: lb://emotion-auth
|
||||
predicates:
|
||||
- Path=/api/auth/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 认证服务路由 - 直接路径
|
||||
- id: emotion-auth-direct
|
||||
uri: lb://emotion-auth
|
||||
predicates:
|
||||
- Path=/auth/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 用户服务路由 - API路径
|
||||
- id: emotion-user-api
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/api/user/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 用户服务路由 - 直接路径
|
||||
- id: emotion-user-direct
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/user/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# AI对话服务路由 - API路径
|
||||
- id: emotion-ai-api
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/api/ai/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# AI对话服务路由 - 直接路径
|
||||
- id: emotion-ai-direct
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由 - API路径
|
||||
- id: emotion-websocket-api
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/api/websocket/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# WebSocket聊天服务路由 - 直接路径
|
||||
- id: emotion-websocket-direct
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/websocket/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 情绪记录服务路由 - API路径
|
||||
- id: emotion-record-api
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/api/record/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 情绪记录服务路由 - 直接路径
|
||||
- id: emotion-record-direct
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/record/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 成长课题服务路由 - API路径
|
||||
- id: emotion-growth-api
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/api/growth/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 成长课题服务路由 - 直接路径
|
||||
- id: emotion-growth-direct
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/growth/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 地图探索服务路由 - API路径
|
||||
- id: emotion-explore-api
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/api/explore/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 地图探索服务路由 - 直接路径
|
||||
- id: emotion-explore-direct
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/explore/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 成就奖励服务路由 - API路径
|
||||
- id: emotion-reward-api
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/api/reward/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 成就奖励服务路由 - 直接路径
|
||||
- id: emotion-reward-direct
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/reward/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 统计分析服务路由 - API路径
|
||||
- id: emotion-stats-api
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/api/stats/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 统计分析服务路由 - 直接路径
|
||||
- id: emotion-stats-direct
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/stats/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 验证码服务路由 (通过认证服务)
|
||||
- id: captcha-service
|
||||
uri: lb://emotion-auth
|
||||
predicates:
|
||||
- Path=/captcha/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
|
||||
|
||||
# 全局过滤器 (暂时禁用,需要实现对应的过滤器类)
|
||||
# default-filters:
|
||||
# - name: GlobalAuthFilter
|
||||
# - name: GlobalLogFilter
|
||||
|
||||
# 监控配置
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,gateway
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
file:
|
||||
path: /data/logs/emotion-museum/gateway
|
||||
level:
|
||||
com.emotionmuseum: debug
|
||||
org.springframework.cloud.gateway: debug
|
||||
pattern:
|
||||
console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level [%logger{50}] - %msg%n"
|
||||
Reference in New Issue
Block a user