mirror of https://github.com/astral-sh/uv
Make pyx credential error message reflect the realm
For example: ``` Run `uv auth login http://localhost:8000` to authenticate uv with pyx ``` While keeping `pyx.dev` for the common case.
This commit is contained in:
parent
4f6f56b070
commit
4149131711
|
|
@ -503,14 +503,13 @@ impl Middleware for AuthMiddleware {
|
||||||
.then_some(self.pyx_token_store.as_ref())
|
.then_some(self.pyx_token_store.as_ref())
|
||||||
.flatten()
|
.flatten()
|
||||||
{
|
{
|
||||||
let domain = store
|
let login_param = match store.api().domain() {
|
||||||
.api()
|
None | Some("api.pyx.dev") => "pyx.dev".to_owned(),
|
||||||
.domain()
|
Some(_) => format!("{}", Realm::from(store.api())),
|
||||||
.unwrap_or("pyx.dev")
|
};
|
||||||
.trim_start_matches("api.");
|
|
||||||
Err(Error::Middleware(format_err!(
|
Err(Error::Middleware(format_err!(
|
||||||
"Run `{}` to authenticate uv with pyx",
|
"Run `{}` to authenticate uv with pyx",
|
||||||
format!("uv auth login {domain}").green()
|
format!("uv auth login {login_param}").green()
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
Err(Error::Middleware(format_err!(
|
Err(Error::Middleware(format_err!(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue