-
Notifications
You must be signed in to change notification settings - Fork 10
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
Allow DB override via hidden parameter #482
Conversation
WalkthroughThe changes add a new configuration option for specifying the database namespace. In Changes
Sequence Diagram(s)sequenceDiagram
participant Main
participant Options
participant Utils
participant DB
Main->>Options: Retrieve DB configuration
alt NameOverride provided
Main->>DB: Call NewNamespacedDB with NameOverride as namespace
else NameOverride not provided
Main->>Utils: Execute BuildNamespace(options)
Utils-->>Main: Return computed namespace
Main->>DB: Call NewNamespacedDB with computed namespace
end
Possibly related PRs
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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)
cmd/replication/main.go (1)
76-79
: Consider adding debug log when override is used.The override logic is correct and maintains backward compatibility. Consider adding a debug log when the override is used to help with debugging.
namespace := options.DB.NameOverride if namespace == "" { namespace = utils.BuildNamespace(options) +} else { + logger.Debug("using overridden database name", zap.String("namespace", namespace)) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cmd/replication/main.go
(1 hunks)pkg/config/options.go
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Test (Node)
🔇 Additional comments (2)
pkg/config/options.go (1)
28-28
: LGTM! Well-structured configuration option.The new
NameOverride
field is properly configured with appropriate tags and follows the established patterns. The hidden flag aligns with its intended use as a testing parameter.cmd/replication/main.go (1)
76-84
: Verify environment variable usage.Let's verify that the environment variable
XMTPD_DB_NAME_OVERRIDE
is properly handled by the configuration parser.✅ Verification successful
🏁 Script executed:
#!/bin/bash # Description: Verify that the environment variable is properly handled. # Test: Search for environment variable usage rg -A 5 'XMTPD_DB_NAME_OVERRIDE' # Test: Search for any tests that verify environment variable handling rg -A 5 'TestDbOptions|TestServerOptions'Length of output: 532
Environment variable
XMTPD_DB_NAME_OVERRIDE
is correctly handled.
- The configuration file
pkg/config/options.go
properly defines theNameOverride
field with theenv:"XMTPD_DB_NAME_OVERRIDE"
tag.- In
cmd/replication/main.go
, ifoptions.DB.NameOverride
is empty, a fallback (utils.BuildNamespace(options)
) is used, confirming that the environment variable, when set, will override the default behavior.
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.
LGTM. This can also be useful for reorg tests.
This is required to upgrade testing to create a separate DB that is only being used by the test.
Will get backported into a 0.1.3 stream.
Summary by CodeRabbit