Updated gateway

This commit is contained in:
2026-03-13 15:36:37 +03:00
parent 542b250515
commit 6a3caa449f
2 changed files with 112 additions and 50 deletions
+56 -25
View File
@@ -1,36 +1,67 @@
server: server:
port: 9080 port: 9080
spring: spring:
application: application:
name: kilimo-gateway name: kilimo-gateway
# 1. Config Server Import (2026 Recommended Syntax)
config:
import: "optional:configserver:https://admin:password@config.qruvw.xyz"
# 2. Redis Configuration
data: data:
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
connect-timeout: 2000ms
# 3. Gateway Routing (Modern WebFlux Namespace)
cloud: cloud:
gateway: gateway:
routes: server:
- id: kilimo_core_service webflux: # CRITICAL: Modern properties live under this node
uri: http://localhost:9081 routes:
predicates: # --- Core Service Route ---
- Path=/core/** - id: kilimo_core_service
filters: uri: http://localhost:9081
- RewritePath=/core/(?<segment>.*), /$\{segment} predicates:
- name: AuthFilter - Path=/core/**
- name: RequestRateLimiter filters:
args: - RewritePath=/core/(?<segment>.*), /$\{segment}
redis-rate-limiter.replenishRate: 10 - name: AuthFilter
redis-rate-limiter.burstCapacity: 20 - name: RequestRateLimiter
key-resolver: "#{@userKeyResolver}" args:
- id: kilimo_assistant_service redis-rate-limiter.replenishRate: 10
uri: http://localhost:9082 redis-rate-limiter.burstCapacity: 20
predicates: key-resolver: "#{@userKeyResolver}"
- Path=/assistant/**
filters: # --- Assistant Service Route ---
- RewritePath=/assistant/(?<segment>.*), /$\{segment} - id: kilimo_assistant_service
- name: AuthFilter uri: http://localhost:9082
- name: RequestRateLimiter predicates:
args: - Path=/assistant/**
redis-rate-limiter.replenishRate: 10 filters:
redis-rate-limiter.burstCapacity: 20 - RewritePath=/assistant/(?<segment>.*), /$\{segment}
key-resolver: "#{@userKeyResolver}" - name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
# 4. Actuator for Troubleshooting
management:
endpoints:
web:
exposure:
include: gateway, health, info
endpoint:
gateway:
enabled: true
# 5. Debugging Logging (Helpful to fix the 404)
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG
+56 -25
View File
@@ -1,36 +1,67 @@
server: server:
port: 9080 port: 9080
spring: spring:
application: application:
name: kilimo-gateway name: kilimo-gateway
# 1. Config Server Import (2026 Recommended Syntax)
config:
import: "optional:configserver:https://admin:password@config.qruvw.xyz"
# 2. Redis Configuration
data: data:
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
connect-timeout: 2000ms
# 3. Gateway Routing (Modern WebFlux Namespace)
cloud: cloud:
gateway: gateway:
routes: server:
- id: kilimo_core_service webflux: # CRITICAL: Modern properties live under this node
uri: http://localhost:9081 routes:
predicates: # --- Core Service Route ---
- Path=/core/** - id: kilimo_core_service
filters: uri: http://localhost:9081
- RewritePath=/core/(?<segment>.*), /$\{segment} predicates:
- name: AuthFilter - Path=/core/**
- name: RequestRateLimiter filters:
args: - RewritePath=/core/(?<segment>.*), /$\{segment}
redis-rate-limiter.replenishRate: 10 - name: AuthFilter
redis-rate-limiter.burstCapacity: 20 - name: RequestRateLimiter
key-resolver: "#{@userKeyResolver}" args:
- id: kilimo_assistant_service redis-rate-limiter.replenishRate: 10
uri: http://localhost:9082 redis-rate-limiter.burstCapacity: 20
predicates: key-resolver: "#{@userKeyResolver}"
- Path=/assistant/**
filters: # --- Assistant Service Route ---
- RewritePath=/assistant/(?<segment>.*), /$\{segment} - id: kilimo_assistant_service
- name: AuthFilter uri: http://localhost:9082
- name: RequestRateLimiter predicates:
args: - Path=/assistant/**
redis-rate-limiter.replenishRate: 10 filters:
redis-rate-limiter.burstCapacity: 20 - RewritePath=/assistant/(?<segment>.*), /$\{segment}
key-resolver: "#{@userKeyResolver}" - name: AuthFilter
- name: RequestRateLimiter
args:
redis-rate-limiter.replenishRate: 10
redis-rate-limiter.burstCapacity: 20
key-resolver: "#{@userKeyResolver}"
# 4. Actuator for Troubleshooting
management:
endpoints:
web:
exposure:
include: gateway, health, info
endpoint:
gateway:
enabled: true
# 5. Debugging Logging (Helpful to fix the 404)
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG