Now Actually Using:
- ValidatedConfig: Parse config into validated types at request time
- ParameterBinding: Type-safe parameter representation
- RequestProcessor: Pure business logic with injected dependencies
- resolve_template_path(): Pure function for path resolution
- resolve_parameters(): Pure parameter resolution
New Adapters (adapters.rs):
- NginxVariableResolver: Implements VariableResolver trait
- SqliteQueryExecutor: Implements QueryExecutor trait
- HandlebarsAdapter: Implements TemplateLoader + TemplateRenderer
Handler Flow (Functional Core, Imperative Shell):
1. Parse strings into validated types (types.rs)
2. Create validated config (domain.rs)
3. Resolve template path (pure function)
4. Create adapters (adapters.rs - imperative shell)
5. Call RequestProcessor.process() (pure core)
6. Return HTML (imperative shell)
Benefits:
✓ Type validation happens at request time
✓ Invalid queries caught early (SELECT-only enforced)
✓ Core business logic is pure and testable
✓ Real DI: can swap implementations via traits
✓ Clear separation of concerns
Test Coverage: 47 tests (added 2 adapter tests)
Production: Verified working with all features
The architecture documented in ARCHITECTURE.md is now actually implemented!
- Update HttpModule trait implementation to match ngx 0.5.0 API
- Implement HttpModuleLocationConf as separate unsafe trait
- Fix configuration access using Module::location_conf()
- Replace ngx_null_command macro with explicit null command
- Update imports to use correct constant names
- Suppress C FFI naming convention warnings