Tauri bootstrap from config.toml and derive API/backend settings from core
Summary
The Tauri (desktop) app should not depend on a pile of build-time VITE_* values for where to reach the OpenHuman core and API. Users will choose the core JSON-RPC URL on the login screen (dedicated UI—not hand-editing config.toml or env files for normal use). After a successful RPC handshake to that sidecar, the app should pull the rest of the effective runtime settings from the core over JSON-RPC (e.g. api_url, and other client-appropriate fields) instead of hardcoding or duplicating them in the bundle.
config.toml remains the core/sidecar config on the machine (operator concern); end users do not configure the RPC URL there—they use the in-app control on login.
Current pain
app/src/utils/config.tsstill leans onVITE_OPENHUMAN_CORE_RPC_URL,VITE_BACKEND_URL, and similar build inputs, so “same app binary, different deployment” is awkward.- Self-hosted / internal users need a discoverable, safe way to point the UI at the right core without a developer rebuild.
- The core already exposes config via JSON-RPC (e.g.
get_config_snapshot/openhuman.config_get— seesrc/openhuman/config/ops.rs); the renderer should treat RPC as the source of truth for downstream URLs after the user picks an RPC base URL.
Goals
- Login-screen RPC URL — A clear form field (or preset + custom URL) for the core JSON-RPC endpoint (e.g.
http://127.0.0.1:7788/rpcor a remote sidecar), with validation (format, reachability) before proceeding. - Persistence — Remember the last used RPC URL locally (Tauri store /
localStorage/ existing prefs pattern—implementation choice) with optional “reset to default.” - Post-login config — After RPC works, call
openhuman.config_get(or a slimui_bootstrap) to fetchapi_urland other safe client fields from the loadedConfig(src/openhuman/config/schema/types.rs), so API server and friends come from core, not a second guess in the web bundle. - Fallbacks — If RPC is unreachable, show actionable errors on the login step; do not silently use a stale backend.
- Minimize remaining
VITE_*to true build constants (Sentry, etc.); document what stays compile-time.
Non-goals (initial)
- Removing every
VITE_*in a single PR — can be phased after the login + bootstrap path works. - Replacing OS keychain for auth tokens (separate work).
Solution direction (for implementation)
- A. Login / welcome flow UI module: RPC URL field, “Test connection” (optional), continue to auth.
- B.
coreRpcClient/ Tauricore_rpc_relay: use the user-selected base URL (saved pref) as the effectiveCORE_RPC_URLfor the session, overriding the Vite default when set. - C. Single RPC method (or existing
config_get) returns a stable, redacted JSON for the webview:apiUrl, feature flags, etc. - D. E2E / unit tests — Prefs + merge logic; at least one test that a custom RPC base is passed through to the client.
Acceptance criteria
- [ ] User can set the RPC URL on the login screen; no
config.tomluser edit required for the common “point at my core” case. - [ ] Last-used URL is persisted and restored on next launch (unless cleared).
- [ ] After a successful RPC connect, the app loads backend / API settings from core (not only from
VITE_BACKEND_URL); document the precedence when both exist during migration. - [ ] Core is authoritative for
api_url(and other exposed client fields) returned over RPC; no secrets in the payload; redact as needed. - [ ] Unit tests in
app/for URL persistence + config merge; E2E (if feasible) or integration test for login →config_gethappy path. - [ ] Docs — User-facing: “Set your sidecar address on the login screen”; developer: what remains in
.envvs runtime.
Related
app/src/utils/config.ts—CORE_RPC_URL,BACKEND_URLdefaultsapp/src/services/coreRpcClient.ts— effective RPC targetapp/src-tauri/…—core_rpc_relay, window prefs if used for storage- Login / onboarding routes under
app/src/pages/,AppRoutes.tsx— where to add the field src/openhuman/config/ops.rs—get_config_snapshot,load_and_get_config_snapshotsrc/openhuman/config/schema/types.rs—api_url,Configtests/json_rpc_e2e.rs—openhuman.config_get
Taking this. Going to start with the login-screen RPC URL field + persist, then swap coreRpcClient to read the saved value, then a small config_get call post-handshake to pull api_url from core. Will leave the broader VITE_* purge for a follow-up so this PR stays reviewable.