Quality: Bloated Config struct — should be split into sub-configs #94

Open
opened 2026-05-11 13:48:54 +00:00 by thabeta · 0 comments
Owner

Severity: Low

Location

crates/hero_aibroker_lib/src/config/mod.rs

Finding

The Config struct has 40+ fields covering unrelated concerns:

  • Provider API keys (5+ fields)
  • Rate limiting (2 fields)
  • Auth (3 fields)
  • MCP servers (nested config)
  • Mother brokers (nested config)
  • HTTP headers (2 fields)
  • OpenRouter-specific settings (3 fields)
  • Model registry paths
  • And more...

Recommendation

  • Split into sub-configs: ProviderConfig, AuthConfig, ServerConfig, McpConfig, CascadeConfig
  • Use composition instead of one giant struct
  • Each sub-config validates itself
## Severity: Low ## Location `crates/hero_aibroker_lib/src/config/mod.rs` ## Finding The `Config` struct has 40+ fields covering unrelated concerns: - Provider API keys (5+ fields) - Rate limiting (2 fields) - Auth (3 fields) - MCP servers (nested config) - Mother brokers (nested config) - HTTP headers (2 fields) - OpenRouter-specific settings (3 fields) - Model registry paths - And more... ## Recommendation - Split into sub-configs: `ProviderConfig`, `AuthConfig`, `ServerConfig`, `McpConfig`, `CascadeConfig` - Use composition instead of one giant struct - Each sub-config validates itself
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_aibroker#94
No description provided.