feat(api): add log_request_body_enabled feature flag support

Add runtime feature flag to control whether request bodies are stored
in logs. The Handler now accepts a Redis client to check the
log_request_body_enabled feature flag before persisting log records.

- Add logRequestBodyFeatureKey constant for feature flag
- Inject Redis client into Handler for feature flag lookups
- Strip request body from log records when feature is disabled
- Update tests to pass Redis client to NewHandler
This commit is contained in:
zenfun
2025-12-21 13:26:16 +08:00
parent 1089f9490e
commit 00192f937e
5 changed files with 31 additions and 9 deletions

View File

@@ -119,7 +119,7 @@ func main() {
masterService := service.NewMasterService(db)
healthService := service.NewHealthCheckService(db, rdb)
handler := api.NewHandler(db, syncService, logWriter)
handler := api.NewHandler(db, syncService, logWriter, rdb)
adminHandler := api.NewAdminHandler(db, masterService, syncService)
masterHandler := api.NewMasterHandler(db, masterService, syncService)
internalHandler := api.NewInternalHandler(db)