引入nacos支持
All checks were successful
test/timeline-server/pipeline/head This commit looks good

This commit is contained in:
2026-01-06 10:59:06 +08:00
parent 4a7c1356d1
commit cf68d35d76
8 changed files with 69 additions and 44 deletions

View File

@@ -1,13 +1,31 @@
# application.properties
# 移除spring.config.import以避免Nacos配置加载问题
spring.config.import=optional:nacos:
spring.application.name=timeline-gateway
server.port=30000
# Nacos配置 - 通过环境变量配置
# 时区配置
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
# UTF-8编码配置
logging.charset.console=UTF-8
logging.charset.file=UTF-8
server.tomcat.uri-encoding=UTF-8
server.servlet.encoding.charset=UTF-8
server.servlet.encoding.enabled=true
server.servlet.encoding.force=true
# 日志配置
logging.level.org.springframework.cloud.gateway=DEBUG
logging.level.com.timeline.gateway=DEBUG
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
# Nacos配置 - 通过环境变量配置
#spring.cloud.nacos.discovery.server-addr=${NACOS_SERVER_ADDR:127.0.0.1:8848}
#spring.cloud.nacos.config.enabled=false
# 使用Nacos服务发现进行路由
# 使用Nacos进行服务发现
spring.cloud.gateway.routes[0].id=story-service
spring.cloud.gateway.routes[0].uri=lb://timeline-story
spring.cloud.gateway.routes[0].predicates[0]=Path=/story/**
@@ -28,7 +46,7 @@ spring.cloud.gateway.routes[3].uri=lb://timeline-user
spring.cloud.gateway.routes[3].predicates[0]=Path=/user/**
spring.cloud.gateway.routes[3].filters[0]=StripPrefix=0
# JWT配置
# JWT配置
jwt.secret=6f3f9c2b9d9a4e3f8c0d6a7b5c4e3f1a6f3f9c2b9d9a4e3f8c0d6a7b5c4e3f1a
jwt.expiration=86400
@@ -38,10 +56,9 @@ spring.data.redis.port=36379
spring.data.redis.password=123456
spring.data.redis.timeout=5000
# Actuator配置
# Actuator配置
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
# 日志配置
logging.level.org.springframework.cloud.gateway=DEBUG
logging.level.com.timeline.gateway=DEBUG
# 网关配置
spring.cloud.gateway.discovery.locator.enabled=true