application.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # 服务端口
  2. server:
  3. port: 4000
  4. # 应用名
  5. spring:
  6. application:
  7. name: app-gateway
  8. # 使用 consul 作为配置中心
  9. profiles:
  10. active: test
  11. config:
  12. import: "consul:"
  13. cloud:
  14. # consul 服务注册
  15. # 如需要查看 Web UI: http://localhost:8500/ui/
  16. consul:
  17. host: 127.0.0.1
  18. port: 8500
  19. # discovery
  20. discovery:
  21. enabled: true
  22. prefer-ip-address: true
  23. instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port}
  24. # config
  25. config:
  26. enabled: true
  27. format: yaml
  28. data-key: data
  29. gateway:
  30. mvc:
  31. routes: # 路由配置
  32. - id: api-location
  33. uri: lb://api-location
  34. predicates:
  35. - Path=/api/*/locatectx/**
  36. - id: api-user
  37. uri: lb://api-user
  38. predicates:
  39. - Path=/api/*/userctx/**
  40. - id: api-message
  41. uri: lb://api-message
  42. predicates:
  43. - Path=/api/*/messagectx/**
  44. # Spring Cloud Gateway 不支持 WebSocket
  45. # api-websocket 请在上衣层中间件转发,例如 Nginx
  46. - id: api-websocket
  47. uri: lb://api-websocket
  48. predicates:
  49. - Path=/api/*/gatewayctx/**
  50. management:
  51. endpoints:
  52. web:
  53. exposure:
  54. include: "*"