Add --base-url flag for connector testability - #8
Conversation
This change adds a --base-url CLI flag to allow overriding the default API endpoint for testing purposes. When provided, the connector will use this URL instead of the hardcoded production API URL. This is part of the Connector Testability initiative to enable mock server testing without modifying connector code. Files changed: cmd/baton-discord/config.go,cmd/baton-discord/main.go,pkg/config/conf.gen.go,pkg/config/config.go,pkg/config/gen/gen.go,pkg/connector/connector.go
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
russellhaering
left a comment
There was a problem hiding this comment.
LGTM - base-url flag implementation looks correct. The discordgo library uses package-level endpoint globals, so the approach of setting them before session creation is the right pattern. Good modernization of the config package structure.
base-url is a dev/testing concern, not user-facing configuration. Mark it WithHidden(true) so it doesn't appear in the hosted UI. Good feedback from Geoff: ConductorOne/baton-trayai#63 (comment)
|
Claude finished @robert-chiniquy's task in 1m 52s —— View job PR Review: Add --base-url flag for connector testability
Overall: Looks good. The approach of overriding discordgo's package-level endpoint globals is the correct pattern given that library's design. The config modernization is clean. Two reviewers have already approved. I verified that all non-function Minor observations1. Unused const DefaultBaseURL = "https://discord.com/"This is declared but never referenced. It could be useful for documentation purposes, but if it's not going to be used (e.g., for validation or as a fallback), consider removing it to avoid dead code. 2. Pre-existing double-slash in discordgo.EndpointVoice = discordgo.EndpointAPI + "/voice/"This mirrors the original discordgo code ( 3. Config improvements — Good call making SummaryClean implementation that correctly handles discordgo's global endpoint pattern. The config package restructuring is a nice modernization. No blocking issues. |
Summary
Adds the
--base-urlCLI flag to enable overriding the default API endpoint for testing purposes.Changes
BaseURLFieldto configuration--base-urlis provided, it takes precedence over the default API URLFiles Modified
Testing
The connector can now be tested against mock servers:
Related
Part of the Connector Testability initiative.