-
Notifications
You must be signed in to change notification settings - Fork 46
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
chore(server): enable to set visualizer db name by .env #1345
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe pull request introduces configuration enhancements for database management in the application. A new configuration field Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
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
Documentation and Community
|
✅ Deploy Preview for reearth-web canceled.
|
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)
server/internal/app/repo.go (1)
69-73
: Consider adding debug logging for database fallback.While the fallback logic is correct, adding debug logging when falling back to the default database would help with troubleshooting configuration issues.
visualizerDatabase := conf.DB_Visualizer if visualizerDatabase == "" { + log.Debugf("Visualizer database not configured, using default database: %s", defaultDatabase) visualizerDatabase = defaultDatabase }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
server/internal/app/config/config.go
(1 hunks)server/internal/app/repo.go
(3 hunks)
🔇 Additional comments (4)
server/internal/app/config/config.go (1)
33-33
: LGTM! Configuration field added correctly.The new
DB_Visualizer
field follows the existing naming convention and is properly tagged withomitempty
.server/internal/app/repo.go (3)
28-28
: LGTM! Improved constant naming.The rename from
databaseName
todefaultDatabase
better reflects its purpose as a fallback value.
45-51
: LGTM! Account database fallback logic is correct.The code properly handles the account database configuration with appropriate fallback to the default database.
75-75
: LGTM! Repository initialization uses correct database.The repository is properly initialized with the configured visualizer database.
server/.env.example
Outdated
@@ -1,6 +1,8 @@ | |||
# General | |||
PORT=8080 | |||
REEARTH_DB=mongodb://localhost | |||
REEARTH_DB_ACCOUNT=reearth # for account database |
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.
we don't need these comments.
Overview
There are problem we can't set database of mongo db by env file.
What I've done
REEARTH_DB_VIS
variable of .env, you can switch visualizer database defined on .env value.What I haven't done
How I tested
Which point I want you to review particularly
Memo
REEARTH_DB_ACCOUNT
variable of .env, you can switch account database defined on .env value.Summary by CodeRabbit
Summary by CodeRabbit
New Features
Refactor