Files
git.stella-ops.org/docs/features/checked/gateway/configurable-route-table-configuration-model.md
2026-02-12 21:02:43 +02:00

39 lines
2.7 KiB
Markdown

# Configurable Route Table - Configuration Model and Validation
## Module
Gateway
## Status
VERIFIED
## Description
The Gateway supports a configurable route table via `GatewayOptions.Routes` (`List<StellaOpsRoute>`). Each route is defined by a `StellaOpsRouteType` enum (Microservice, ReverseProxy, StaticFiles, StaticFile, WebSocket, NotFoundPage, ServerErrorPage), a `Path`, an optional `IsRegex` flag, a `TranslatesTo` target, and optional `Headers` dictionary. The `GatewayOptionsValidator` validates all routes with type-specific rules: ReverseProxy requires valid HTTP(S) URL, WebSocket requires ws:///wss:// URL, StaticFiles/StaticFile/NotFoundPage/ServerErrorPage require non-empty file/directory paths, all routes require non-empty Path, and regex paths must be valid regex patterns.
## Implementation Details
- **Modules**: `src/Router/__Libraries/StellaOps.Router.Gateway/`, `src/Router/StellaOps.Gateway.WebService/`
- **Key Classes**:
- `StellaOpsRoute` (`src/Router/__Libraries/StellaOps.Router.Gateway/Configuration/StellaOpsRoute.cs`) - Route model class with `StellaOpsRouteType` enum (7 values)
- `GatewayOptions` (`src/Router/StellaOps.Gateway.WebService/Configuration/GatewayOptions.cs`) - `Routes` property (`List<StellaOpsRoute>`)
- `GatewayOptionsValidator` (`src/Router/StellaOps.Gateway.WebService/Configuration/GatewayOptionsValidator.cs`) - Type-specific validation rules for all 7 route types
- **Tests**:
- `GatewayOptionsValidatorTests` (`src/Router/__Tests/StellaOps.Gateway.WebService.Tests/Configuration/GatewayOptionsValidatorTests.cs`) - 11 route validation tests
- `StellaOpsRouteResolverTests` (`src/Router/__Tests/StellaOps.Gateway.WebService.Tests/Routing/StellaOpsRouteResolverTests.cs`) - 9 resolver unit tests
## E2E Test Plan
- [ ] Validate that a ReverseProxy route with invalid URL fails validation
- [ ] Validate that a WebSocket route with non-ws:// URL fails validation
- [ ] Validate that a StaticFiles route with empty TranslatesTo fails validation
- [ ] Validate that a route with empty Path fails validation
- [ ] Validate that a route with IsRegex=true and invalid regex fails validation
- [ ] Validate that a properly configured route table with all 7 types passes validation
- [ ] Gateway starts successfully with a valid route table configuration
## Verification
- **Run ID**: run-001
- **Date**: 2026-02-12
- **Method**: Tier 0 source verification + Tier 1 build/code review (224/224 tests pass) + Tier 2a live HTTP API testing
- **Build**: PASS (0 errors, 0 warnings)
- **Tests**: PASS (224/224 Gateway tests pass)
- **Tier 2a Evidence**: `docs/qa/feature-checks/runs/gateway/configurable-route-table-configuration-model/run-001/tier2-api-check.json`
- **Verdict**: PASS