Gateway Service Configuration
Environment Variables
Server Configuration
HOST=0.0.0.0
PORT=8000
Authentication
AUTHENTICATION_SERVICE_URL=http://authentication:8001
JWT_SECRET=your-jwt-secret-key
JWT_ALGORITHM=HS256
Redis
REDIS_URL=redis://localhost:6379
Database (Optional)
DATABASE_URL=postgresql://user:password@localhost:5432/wanga_gateway
Rate Limiting
RATE_LIMIT_ENABLED=true
RATE_LIMIT_PREMIUM=1000 # requests per minute
RATE_LIMIT_STANDARD=100
RATE_LIMIT_FREE=10
Circuit Breaker
CIRCUIT_BREAKER_FAILURE_THRESHOLD=5
CIRCUIT_BREAKER_TIMEOUT=60 # seconds
CIRCUIT_BREAKER_HALF_OPEN_MAX_CALLS=3
Logging
RUST_LOG=info,gateway=debug
OpenTelemetry
OTLP_ENDPOINT=http://otel-collector:4317
OTLP_SERVICE_NAME=gateway
Configuration Files
Cargo.toml
Rust project dependencies and metadata.
config/config.toml
Service-specific configuration (if using config crate).
Service Routes
Configure backend service routes:
[services]
payment = "http://payment:8001"
authentication = "http://authentication:8001"
federation = "http://federation:8020"
Rate Limiting Configuration
Rate limits can be configured per user tier or API key in Redis or database.