Add handler

This commit is contained in:
Jon Staab
2025-09-23 16:44:26 -07:00
parent bb0269b728
commit 6642cba977
13 changed files with 314 additions and 3 deletions
+12
View File
@@ -0,0 +1,12 @@
`README.md` contains high-level project information.
`justfile` contains common commands.
## Codebase Overview
- **zooid/config.go**: Defines `Config` struct with TOML tags for relay configuration (self info, groups, roles, data paths). Contains `loadConfig()` function that parses hostname-based config files from `configs/` directory.
- **zooid/http.go**: Core HTTP handling with dynamic instance creation. `getInstance()` function loads config and creates khatru relay instances on-demand. `ServeHTTP()` function routes requests to appropriate relay instances based on hostname.
- **zooid/util.go**: Environment variable utilities. `Env()` function with fallback support for configuration.
- **cmd/relay/main.go**: Main entry point that starts HTTP server with graceful shutdown handling. Uses `zooid.ServeHTTP` as the handler wrapped in `http.HandlerFunc`.