SP-4383: Environmental variable support - #157
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughDefaults for API URL/token are set earlier during config initialization. initializeApiConfig now populates API settings from SCANOSS_SCAN_URL and SCANOSS_API_KEY when arguments are empty, then applies CLI overrides. Tests and changelog were added to cover and document this behavior. ChangesAPI Configuration Enhancement
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
SCANOSS SCAN Completed 🚀
View more details on SCANOSS Action Summary |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/config/config.go`:
- Around line 355-369: The env-var branch in initializeApiConfig currently
writes directly to c.apiUrl / c.apiToken which bypasses viper and
notifyListeners causing divergence and swallowed errors; update the logic to
either use viper.BindEnv("apiurl") / viper.BindEnv("apitoken") so viper reflects
env values, or call the existing setters c.SetApiUrl(v) and c.SetApiToken(v)
(which will call notifyListeners and return errors) / or at minimum call
viper.Set("apiurl"/"apitoken") followed by notifyListeners(); ensure you use the
initializeApiConfig function and SetApiUrl/SetApiToken or viper.BindEnv so
future viper.WriteConfig() persists the correct, non-stale values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 741d0bce-347f-4ff5-8649-c33fb106969a
📒 Files selected for processing (2)
internal/config/config.gointernal/config/config_test.go
SCANOSS SCAN Completed 🚀
View more details on SCANOSS Action Summary |
Summary by CodeRabbit
New Features
Tests
Documentation