mirror of https://github.com/astral-sh/uv
Respect `UV_INDEX_` rather than `UV_HTTP_BASIC_` (#8306)
The docs reference `UV_INDEX_`, but the code actually uses UV_HTTP_BASIC_ as the prefix for environment variable credentials. See PR #7741 Code is at https://github.com/astral-sh/uv/blob/main/crates/uv-static/src/env_vars.rs#L163 ```rust /// Generates the environment variable key for the HTTP Basic authentication username. pub fn http_basic_username(name: &str) -> String { format!("UV_HTTP_BASIC_{name}_USERNAME") } /// Generates the environment variable key for the HTTP Basic authentication password. pub fn http_basic_password(name: &str) -> String { format!("UV_HTTP_BASIC_{name}_PASSWORD") } ``` --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
parent
c62f8d769c
commit
3fd69b448e
|
|
@ -147,8 +147,8 @@ impl Credentials {
|
||||||
/// `UV_HTTP_BASIC_PYTORCH_PASSWORD`.
|
/// `UV_HTTP_BASIC_PYTORCH_PASSWORD`.
|
||||||
pub fn from_env(name: &str) -> Option<Self> {
|
pub fn from_env(name: &str) -> Option<Self> {
|
||||||
let name = name.to_uppercase();
|
let name = name.to_uppercase();
|
||||||
let username = std::env::var(EnvVars::http_basic_username(&name)).ok();
|
let username = std::env::var(EnvVars::index_username(&name)).ok();
|
||||||
let password = std::env::var(EnvVars::http_basic_password(&name)).ok();
|
let password = std::env::var(EnvVars::index_password(&name)).ok();
|
||||||
if username.is_none() && password.is_none() {
|
if username.is_none() && password.is_none() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -160,13 +160,13 @@ impl EnvVars {
|
||||||
pub const UV_STACK_SIZE: &'static str = "UV_STACK_SIZE";
|
pub const UV_STACK_SIZE: &'static str = "UV_STACK_SIZE";
|
||||||
|
|
||||||
/// Generates the environment variable key for the HTTP Basic authentication username.
|
/// Generates the environment variable key for the HTTP Basic authentication username.
|
||||||
pub fn http_basic_username(name: &str) -> String {
|
pub fn index_username(name: &str) -> String {
|
||||||
format!("UV_HTTP_BASIC_{name}_USERNAME")
|
format!("UV_INDEX_{name}_USERNAME")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates the environment variable key for the HTTP Basic authentication password.
|
/// Generates the environment variable key for the HTTP Basic authentication password.
|
||||||
pub fn http_basic_password(name: &str) -> String {
|
pub fn index_password(name: &str) -> String {
|
||||||
format!("UV_HTTP_BASIC_{name}_PASSWORD")
|
format!("UV_INDEX_{name}_PASSWORD")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to set the uv commit hash at build time via `build.rs`.
|
/// Used to set the uv commit hash at build time via `build.rs`.
|
||||||
|
|
@ -184,12 +184,6 @@ impl EnvVars {
|
||||||
/// Used to set the uv tag distance from head at build time via `build.rs`.
|
/// Used to set the uv tag distance from head at build time via `build.rs`.
|
||||||
pub const UV_LAST_TAG_DISTANCE: &'static str = "UV_LAST_TAG_DISTANCE";
|
pub const UV_LAST_TAG_DISTANCE: &'static str = "UV_LAST_TAG_DISTANCE";
|
||||||
|
|
||||||
/// Used in tests for testing providing credentials via environment variables.
|
|
||||||
pub const UV_HTTP_BASIC_PROXY_USERNAME: &'static str = "UV_HTTP_BASIC_PROXY_USERNAME";
|
|
||||||
|
|
||||||
/// Used in tests for testing providing credentials via environment variables.
|
|
||||||
pub const UV_HTTP_BASIC_PROXY_PASSWORD: &'static str = "UV_HTTP_BASIC_PROXY_PASSWORD";
|
|
||||||
|
|
||||||
/// Used to set the spawning/parent interpreter when using --system in the test suite.
|
/// Used to set the spawning/parent interpreter when using --system in the test suite.
|
||||||
pub const UV_INTERNAL__PARENT_INTERPRETER: &'static str = "UV_INTERNAL__PARENT_INTERPRETER";
|
pub const UV_INTERNAL__PARENT_INTERPRETER: &'static str = "UV_INTERNAL__PARENT_INTERPRETER";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6678,8 +6678,8 @@ fn lock_env_credentials() -> Result<()> {
|
||||||
|
|
||||||
// Provide credentials via environment variables.
|
// Provide credentials via environment variables.
|
||||||
uv_snapshot!(context.filters(), context.lock()
|
uv_snapshot!(context.filters(), context.lock()
|
||||||
.env(EnvVars::UV_HTTP_BASIC_PROXY_USERNAME, "public")
|
.env(EnvVars::index_username("PROXY"), "public")
|
||||||
.env(EnvVars::UV_HTTP_BASIC_PROXY_PASSWORD, "heron"), @r###"
|
.env(EnvVars::index_password("PROXY"), "heron"), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue