fix(agent): load environment variables when no config file is provided#171
Conversation
The agent command was using config.New() when no --config flag was provided, which skips environment variable loading entirely. This meant env vars like NETRONOME__AGENT_HOST, NETRONOME__AGENT_PORT, and NETRONOME__AGENT_API_KEY were silently ignored. Now uses config.Load() which searches for config files in default paths and always applies environment variable overrides, matching the behavior of the serve command. Closes #102
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughModified config loading in the agent's main function to unconditionally load configuration files, gracefully fall back to defaults on failure, and apply command-line flag overrides with proper precedence after loading. Logger initialization was moved post-config to ensure correct configuration propagation. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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
Comment |
Summary
config.New()when no--configflag was provided, which skips environment variable loading entirely. Env vars likeNETRONOME__AGENT_HOST,NETRONOME__AGENT_PORT, andNETRONOME__AGENT_API_KEYwere silently ignored.config.Load()which searches for config files in default paths and always applies environment variable overrides, matching the behavior of theservecommand.Test plan
NETRONOME__AGENT_HOSTandNETRONOME__AGENT_PORTenv vars set (no--configflag) and verify it binds to the correct addressNETRONOME__AGENT_API_KEYset and verify authentication is enabled--configflag and verify config file + env vars still work as beforeCloses #102
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.