application.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # 观澜 v2 · Java 网关(Spring Cloud Gateway + OAuth2/JWT 校验 + Nacos 可选)
  2. #
  3. # 端口 28085:与现 Python 网关 28084 **并存**,迁移期按前缀灰度切换(用户令:可回滚)。
  4. # 路由表直接写在配置里 —— 单体/离线模式不依赖注册中心;要接 Nacos 时把 guanlan.nacos.enabled 置 true。
  5. server:
  6. port: 28085
  7. spring:
  8. application:
  9. name: guanlan-gateway
  10. cloud:
  11. gateway:
  12. # 统一入口的路由(与现 Python 网关 gateway.py 的前缀表一一对应)
  13. routes:
  14. - id: algorithm
  15. uri: http://127.0.0.1:18050
  16. predicates:
  17. - Path=/algorithm/**
  18. filters:
  19. - StripPrefix=1
  20. - id: web
  21. uri: http://127.0.0.1:28110
  22. predicates:
  23. - Path=/web/**
  24. filters:
  25. - StripPrefix=1
  26. - id: detail
  27. uri: http://127.0.0.1:18033
  28. predicates:
  29. - Path=/detail/**
  30. filters:
  31. - StripPrefix=1
  32. - id: cms
  33. uri: http://127.0.0.1:18020
  34. predicates:
  35. - Path=/cms/**
  36. filters:
  37. - StripPrefix=1
  38. httpclient:
  39. connect-timeout: 5000
  40. response-timeout: 120s
  41. # Nacos 服务发现(可选;enabled=false 时单体模式照跑)
  42. nacos:
  43. discovery:
  44. enabled: ${guanlan.nacos.enabled:false}
  45. server-addr: ${guanlan.nacos.addr:127.0.0.1:8848}
  46. guanlan:
  47. nacos:
  48. enabled: false
  49. addr: 127.0.0.1:8848
  50. # 与业务后端**同一密钥**(HMAC):网关侧只做校验,签发在业务后端 /java/token
  51. jwt:
  52. secret: ${GUANLAN_JWT_SECRET:guanlan-offline-hmac-secret-change-me-0123456789abcdef}
  53. issuer: guanlan
  54. management:
  55. endpoints:
  56. web:
  57. exposure:
  58. include: health,info,gateway
  59. logging:
  60. level:
  61. root: INFO
  62. com.guanlan: INFO
  63. org.springframework.cloud.gateway: INFO