Repository navigation
fix: env var decoding for bool config fields, redis sentinel multi-node support and change fs.FS path construction - #4545
vsengar-79 wants to merge 6 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughFour small fixes update a sink Kafka configuration key, extend decode-hook conversions, support multiple Redis Sentinel addresses, and use slash-based paths in migrate filesystem handling. ChangesMisc Fixes
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change corrects configuration decoding and keys, adds Redis Sentinel address parsing, and uses slash-based filesystem paths. No concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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.
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 `@pkg/redis/client.go`:
- Around line 61-68: The code splits and trims sentinel addresses but does not
filter out empty strings that can result from trailing, leading, or double
commas in the address string. After trimming each address in the sentinelAddrs
loop, filter out any entries that are empty strings. Additionally, add
validation after the loop to ensure the final sentinelAddrs slice is not empty,
and fail fast with an appropriate error message if no valid sentinel addresses
remain after filtering.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 28f3a5df-20d6-455d-bc7f-ff317c165a1e
📒 Files selected for processing (4)
app/config/sink.goapp/config/viper.gopkg/redis/client.gotools/migrate/fs.go
Greptile SummaryFour small but meaningful bug-fixes for Kubernetes deployments where config arrives as env var strings. Covers bool coercion during viper decode, a Kafka consumer group ID key typo, Redis Sentinel multi-node address support, and cross-platform
Confidence Score: 5/5All four changes are targeted, backward-compatible bug fixes with no new logic paths that could regress existing behaviour. Each change is narrowly scoped: a one-line hook addition, a key-name typo fix, an address-parsing loop with an explicit guard, and an import swap. No new abstractions, no schema changes, and the sentinel parsing is explicitly backward-compatible with single-address strings. No files require special attention. Important Files Changed
|
|
This pull request has been inactive for 45 days. Push a commit or leave a comment describing the next step to remove the |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Signed-off-by: vsengar-79 <[email protected]>
Signed-off-by: vsengar-79 <[email protected]>
Signed-off-by: vsengar-79 <[email protected]>
Signed-off-by: vsengar-79 <[email protected]>
filepath.Join uses the OS path separator (\ on Windows), which breaks fs.FS implementations that require forward-slash paths per the io/fs spec. Replace with path.Join which always uses /. Signed-off-by: vsengar-79 <[email protected]>
Refactor sentinel address handling to trim whitespace and validate addresses. Signed-off-by: vsengar-79 <[email protected]>
|
@vsengar-79 I love this PR but I think we are doing too much here. I am fine merging both the pkg/redis/client.go — Redis Sentinel multi-node support and the tools/migrate/fs.go — use path.Join instead of filepath.Join for fs.FS path construction For the other two, I we need to do a deeper assessment of what they are doing in terms of our existing production systems, so that will take some time. If you split this into two PRs I can merge the first. For example Viper currently treats "" as false, but the new hook calls strconv.ParseBool("") and returns an error first. Literal "false" still parses correctly. |
|
This pull request has been inactive for 45 days. Push a commit or leave a comment describing the next step to remove the |
Overview
Four small fixes for running OpenMeter in Kubernetes where config values arrive as environment variable strings rather than typed YAML values.
app/config/viper.go— bool env var decodingAdded
StringToBasicTypeHookFunc()to the globalDecodeHook. When config values are set via env vars or ConfigMaps, they are always strings —"true","false","1". Without this hook, anyboolconfig field panics on startup with:This affects fields like
DEDUPE_ENABLED,NOTIFICATION_ENABLED, and any other boolean config sourced from the environment.app/config/sink.go— consumer group ID key name typosink.kafka.consumerGroupId→sink.kafka.consumerGroupID(capitalIDto match the struct field's mapstructure tag). Fixed a little typo.pkg/redis/client.go— Redis Sentinel multi-node supportThe
Addressfield now supports a comma-separated list of sentinel nodes (e.g."sentinel1:26379,sentinel2:26379,sentinel3:26379"). Previously it was hardcoded to[]string{o.Address}, which only ever used a single sentinel endpoint regardless of what was configured.tools/migrate/fs.go— usepath.Joininstead offilepath.Joinforfs.FSpath constructionfilepath.Joinuses the OS path separator (\on Windows), which breaksfs.FSimplementations that require forward-slash paths per theio/fsspec. Replace withpath.Joinwhich always uses/Notes for reviewer
StringToBasicTypeHookFunconly activates when the target struct field is a basic type (bool,int,float64) — it has no effect on string fields orinterface{}maps. Existing YAML-based configs are unaffected since YAML already deserialises native types correctly.strings.Spliton a non-comma string returns a single-element slice, identical to the previous[]string{o.Address}behaviour.pathpackage (always forward-slash) is used instead offilepath(OS-dependent separator) becausefs.FSrequires forward-slash paths on all platforms per theio/fsspec; the function parameter was renamed frompathtodirto avoid shadowing the import.Summary by CodeRabbit
New Features
Improvements
Bug Fixes
The PR appears safe to merge; no outstanding findings remain.
Summary
The PR converts string configuration values to basic types, corrects the Kafka consumer-group default key, supports multiple Redis Sentinel addresses, and uses slash-separated migration filesystem paths.
Reviews (5) · Last reviewed commit: "Improve sentinel address parsing in Redi..."