feat: 项目初始化及当前全部内容提交
This commit is contained in:
@@ -0,0 +1,215 @@
|
||||
# 网关服务测试环境配置
|
||||
server:
|
||||
port: 9000
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: emotion-gateway
|
||||
profiles:
|
||||
active: test
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
|
||||
namespace: emotion-test
|
||||
group: TEST_GROUP
|
||||
enabled: true
|
||||
ip: ${SERVER_IP:localhost}
|
||||
port: ${server.port}
|
||||
metadata:
|
||||
version: 1.0.0
|
||||
environment: test
|
||||
config:
|
||||
server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
|
||||
file-extension: yml
|
||||
namespace: emotion-test
|
||||
group: TEST_GROUP
|
||||
enabled: true
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
# 用户服务路由
|
||||
- id: emotion-user
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/api/user/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
- name: RequestRateLimiter
|
||||
args:
|
||||
redis-rate-limiter.replenishRate: 10
|
||||
redis-rate-limiter.burstCapacity: 20
|
||||
key-resolver: "#{@ipKeyResolver}"
|
||||
|
||||
# AI服务路由
|
||||
- id: emotion-ai
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/api/ai/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
- name: RequestRateLimiter
|
||||
args:
|
||||
redis-rate-limiter.replenishRate: 5
|
||||
redis-rate-limiter.burstCapacity: 10
|
||||
key-resolver: "#{@ipKeyResolver}"
|
||||
|
||||
# 认证服务路由
|
||||
- id: emotion-auth
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/api/auth/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 公共API路由
|
||||
- id: emotion-public
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/api/public/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 健康检查路由
|
||||
- id: health-check
|
||||
uri: lb://emotion-gateway
|
||||
predicates:
|
||||
- Path=/health
|
||||
filters:
|
||||
- SetPath=/actuator/health
|
||||
|
||||
# 全局过滤器配置
|
||||
default-filters:
|
||||
- name: GlobalRequestLog
|
||||
- name: GlobalResponseLog
|
||||
- name: AddResponseHeader
|
||||
args:
|
||||
name: X-Response-Server
|
||||
value: emotion-gateway-test
|
||||
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
database: 0
|
||||
timeout: 6000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
max-idle: 8
|
||||
min-idle: 2
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
com.emotionmuseum: INFO
|
||||
org.springframework.cloud.gateway: INFO
|
||||
org.springframework.web.reactive: INFO
|
||||
reactor.netty: INFO
|
||||
pattern:
|
||||
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}] - %msg%n"
|
||||
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}] - %msg%n"
|
||||
file:
|
||||
name: /data/logs/emotion-museum/gateway-service.log
|
||||
max-size: 100MB
|
||||
max-history: 30
|
||||
|
||||
# 管理端点
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus,gateway,env
|
||||
base-path: /actuator
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
show-components: always
|
||||
gateway:
|
||||
enabled: true
|
||||
metrics:
|
||||
export:
|
||||
prometheus:
|
||||
enabled: true
|
||||
|
||||
# 跨域配置
|
||||
cors:
|
||||
configurations:
|
||||
'[/**]':
|
||||
allowed-origins:
|
||||
- "http://localhost:3000"
|
||||
- "http://localhost:8080"
|
||||
- "http://${SERVER_IP:localhost}"
|
||||
- "http://${SERVER_IP:localhost}:3000"
|
||||
- "http://${SERVER_IP:localhost}:8080"
|
||||
allowed-methods:
|
||||
- GET
|
||||
- POST
|
||||
- PUT
|
||||
- DELETE
|
||||
- OPTIONS
|
||||
allowed-headers:
|
||||
- "*"
|
||||
allow-credentials: true
|
||||
max-age: 3600
|
||||
|
||||
# 限流配置
|
||||
rate-limit:
|
||||
enabled: true
|
||||
default-replenish-rate: 10
|
||||
default-burst-capacity: 20
|
||||
routes:
|
||||
emotion-user:
|
||||
replenish-rate: 20
|
||||
burst-capacity: 40
|
||||
emotion-ai:
|
||||
replenish-rate: 5
|
||||
burst-capacity: 10
|
||||
|
||||
# 熔断配置
|
||||
resilience4j:
|
||||
circuitbreaker:
|
||||
instances:
|
||||
emotion-user:
|
||||
failure-rate-threshold: 50
|
||||
wait-duration-in-open-state: 30s
|
||||
sliding-window-size: 10
|
||||
minimum-number-of-calls: 5
|
||||
emotion-ai:
|
||||
failure-rate-threshold: 60
|
||||
wait-duration-in-open-state: 60s
|
||||
sliding-window-size: 10
|
||||
minimum-number-of-calls: 3
|
||||
timelimiter:
|
||||
instances:
|
||||
emotion-user:
|
||||
timeout-duration: 10s
|
||||
emotion-ai:
|
||||
timeout-duration: 30s
|
||||
|
||||
# 安全配置
|
||||
security:
|
||||
ignore-urls:
|
||||
- /actuator/**
|
||||
- /api/auth/login
|
||||
- /api/auth/register
|
||||
- /api/public/**
|
||||
- /health
|
||||
jwt:
|
||||
secret: ${JWT_SECRET:emotion-museum-test-secret-key-2025}
|
||||
expiration: ${JWT_EXPIRATION:7200}
|
||||
|
||||
# 测试环境特殊配置
|
||||
test:
|
||||
debug:
|
||||
enabled: true
|
||||
log-requests: true
|
||||
log-responses: false
|
||||
mock:
|
||||
enabled: false
|
||||
Reference in New Issue
Block a user