feat(sidebar): read LibreChat URL from LIBRECHAT_URL env var
Some checks failed
CI / Format (push) Failing after 2s
CI / Tests (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / Deploy (push) Has been cancelled
CI / Deploy (pull_request) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Security Audit (pull_request) Has been cancelled
CI / Tests (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled

Replace hardcoded localhost:3080 chat link with configurable
LIBRECHAT_URL environment variable, passed through AuthInfo to
the sidebar component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-02-24 12:32:57 +01:00
parent 7f13273ded
commit 5c7ab71edc
4 changed files with 19 additions and 10 deletions

View File

@@ -24,13 +24,18 @@ pub async fn check_auth() -> Result<AuthInfo, ServerFnError> {
.map_err(|e| ServerFnError::new(format!("session read failed: {e}")))?;
match user_state {
Some(u) => Ok(AuthInfo {
authenticated: true,
sub: u.sub,
email: u.user.email,
name: u.user.name,
avatar_url: u.user.avatar_url,
}),
Some(u) => {
let librechat_url = std::env::var("LIBRECHAT_URL")
.unwrap_or_else(|_| "http://localhost:3080".into());
Ok(AuthInfo {
authenticated: true,
sub: u.sub,
email: u.user.email,
name: u.user.name,
avatar_url: u.user.avatar_url,
librechat_url,
})
}
None => Ok(AuthInfo::default()),
}
}