-
Notifications
You must be signed in to change notification settings - Fork 1.1k
prefer VITE_SERVER_URL env var #1146
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
Conversation
WalkthroughReordered server_url resolution during app initialization: now checks VITE_SERVER_URL env var first, then GeneralSettingsStore’s server_url, then a hardcoded default. No public interfaces changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App as App Init
participant Env as Env (VITE_SERVER_URL)
participant Settings as GeneralSettingsStore
participant Default as Default URL
User->>App: Launch
App->>Env: Read VITE_SERVER_URL
alt Env var present
Env-->>App: server_url
note right of App: Use env value (new precedence)
else Env var absent
App->>Settings: Read server_url
alt Settings has value
Settings-->>App: server_url
else
App->>Default: Use fallback
Default-->>App: hardcoded URL
end
end
App-->>User: App initialized with resolved server_url
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 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.
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)
apps/desktop/src-tauri/src/lib.rs (1)
2200-2208: Consider handling emptyserver_urlvalues.If
server_urlinGeneralSettingsStoreis an empty string (e.g., from missing field with#[serde(default)]or user configuration), the current logic would use it instead of falling back to the default"https://cap.so". This could cause connection failures.Apply this diff to treat empty strings as None:
server_url: std::option_env!("VITE_SERVER_URL") .map(|s| s.to_string()) - .or_else(|| { + .or_else(|| { GeneralSettingsStore::get(&app) .ok() .flatten() - .map(|v| v.server_url.clone()) + .and_then(|v| { + (!v.server_url.is_empty()).then(|| v.server_url.clone()) + }) }) .unwrap_or_else(|| "https://cap.so".to_string()),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/desktop/src-tauri/src/lib.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx,rs}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not add inline, block, or docstring comments in any language; code must be self-explanatory
Files:
apps/desktop/src-tauri/src/lib.rs
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Format Rust code usingrustfmtand ensure all Rust code passes workspace-level clippy lints.
Rust modules should be named with snake_case, and crate directories should be in kebab-case.
Files:
apps/desktop/src-tauri/src/lib.rs
🧬 Code graph analysis (1)
apps/desktop/src-tauri/src/lib.rs (2)
apps/desktop/src/utils/tauri.ts (1)
GeneralSettingsStore(393-393)apps/desktop/src-tauri/src/general_settings.rs (1)
get(183-194)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Analyze (rust)
Summary by CodeRabbit