mirror of https://github.com/astral-sh/uv
Respect `PYX_API_URL` when suggesting `uv auth login` on 401 (#15774)
This commit is contained in:
parent
ccf01fff66
commit
27d205b0c3
|
|
@ -465,11 +465,18 @@ impl Middleware for AuthMiddleware {
|
|||
|
||||
if let Some(response) = response {
|
||||
Ok(response)
|
||||
} else {
|
||||
if is_known_url {
|
||||
} else if let Some(store) = is_known_url
|
||||
.then_some(self.pyx_token_store.as_ref())
|
||||
.flatten()
|
||||
{
|
||||
let domain = store
|
||||
.api()
|
||||
.domain()
|
||||
.unwrap_or("pyx.dev")
|
||||
.trim_start_matches("api.");
|
||||
Err(Error::Middleware(format_err!(
|
||||
"Run `{}` to authenticate the uv CLI",
|
||||
"uv auth login pyx.dev".green()
|
||||
"Run `{}` to authenticate uv with pyx",
|
||||
format!("uv auth login {domain}").green()
|
||||
)))
|
||||
} else {
|
||||
Err(Error::Middleware(format_err!(
|
||||
|
|
@ -477,7 +484,6 @@ impl Middleware for AuthMiddleware {
|
|||
)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AuthMiddleware {
|
||||
|
|
|
|||
Loading…
Reference in New Issue