-
Notifications
You must be signed in to change notification settings - Fork 150
feat: support config.yaml and config.yml loading with reference support #1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThe config loading system now supports YAML format alongside JSON, searching for config.json, config.yaml, and config.yml in order and loading the first found. YAML files are parsed and converted to JSON before processing. A YAML dependency is added and tests validate precedence and YAML anchor behavior. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
transports/bifrost-http/lib/config.go (1)
253-266: Update function documentation to reflect YAML support.The function comment references "JSON config file parsing" but the function now supports YAML as well. Consider updating the documentation:
-// LoadConfig loads initial configuration from a JSON config file into memory +// LoadConfig loads initial configuration from a config file (JSON or YAML) into memory // with full preprocessing including environment variable resolution and key config parsing. // All processing is done upfront to ensure zero latency when retrieving data. // -// If the config file doesn't exist, the system starts with default configuration +// If no config file exists, the system starts with default configuration // and users can add providers dynamically via the HTTP API. // // This method handles: -// - JSON config file parsing +// - Config file parsing (config.json, config.yaml, or config.yml in that order) +// - YAML anchor/alias resolution via conversion to JSON
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
transports/bifrost-http/lib/config.go(2 hunks)transports/bifrost-http/lib/config_yaml_test.go(1 hunks)transports/go.mod(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
always check the stack if there is one for the current PR. do not give localized reviews for the PR, always see all changes in the light of the whole stack of PRs (if there is a stack, if there is no stack you can continue to make localized suggestions/reviews)
Files:
transports/bifrost-http/lib/config.gotransports/go.modtransports/bifrost-http/lib/config_yaml_test.go
🧠 Learnings (1)
📚 Learning: 2025-12-09T17:07:42.007Z
Learnt from: qwerty-dvorak
Repo: maximhq/bifrost PR: 1006
File: core/schemas/account.go:9-18
Timestamp: 2025-12-09T17:07:42.007Z
Learning: In core/schemas/account.go, the HuggingFaceKeyConfig field within the Key struct is currently unused and reserved for future Hugging Face inference endpoint deployments. Do not flag this field as missing from OpenAPI documentation or require its presence in the API spec until the feature is actively implemented and used. When the feature is added, update the OpenAPI docs accordingly; otherwise, treat this field as non-breaking and not part of the current API surface.
Applied to files:
transports/bifrost-http/lib/config.gotransports/bifrost-http/lib/config_yaml_test.go
🧬 Code graph analysis (1)
transports/bifrost-http/lib/config_yaml_test.go (2)
transports/bifrost-http/lib/config.go (1)
LoadConfig(267-377)framework/configstore/clientconfig.go (1)
ClientConfig(36-50)
🔇 Additional comments (5)
transports/go.mod (1)
21-21: LGTM!The promotion of
gopkg.in/yaml.v3from indirect to direct dependency is appropriate since it's now explicitly used inconfig.gofor YAML configuration parsing.transports/bifrost-http/lib/config.go (2)
30-30: LGTM!The YAML library import is correctly added to support the new configuration format.
287-323: LGTM - Clean implementation of multi-format config loading.The approach of converting YAML to JSON before processing is well-designed:
- Properly handles YAML anchors/aliases via
yaml.v3- Maintains compatibility with existing JSON unmarshaling logic
- Clear error messages for parse/conversion failures
- Correct precedence: config.json → config.yaml → config.yml
transports/bifrost-http/lib/config_yaml_test.go (2)
71-111: LGTM - Comprehensive precedence test.The test validates both critical scenarios:
- JSON takes precedence when both files exist (InitialPoolSize = 10)
- YAML is used as fallback when JSON is removed (InitialPoolSize = 20)
This aligns well with the documented load order in
LoadConfig.
10-69: LGTM - Good coverage of YAML-specific features.The test effectively validates:
- Basic YAML parsing and conversion to JSON
- YAML anchor (
&common) and merge key (<<: *common) functionality- Inherited values from anchors (key 1 inherits
valuefrom anchor)- Provider and key structure preservation
The
createTempDirhelper is properly defined in the test package (config_test.go).
Summary
config.json is long, has alot same parts, use yaml can make this easier to write.
Changes
Type of change
Affected areas
How to test
Describe the steps to validate this change. Include commands and expected outcomes.
If adding new configs or environment variables, document them here.
Screenshots/Recordings
If UI changes, add before/after screenshots or short clips.
Breaking changes
If yes, describe impact and migration instructions.
Related issues
Link related issues and discussions. Example: Closes #123
Security considerations
Note any security implications (auth, secrets, PII, sandboxing, etc.).
Checklist
docs/contributing/README.mdand followed the guidelines