Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/uv-auth/src/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ impl Credentials {
/// `UV_HTTP_BASIC_PYTORCH_PASSWORD`.
pub fn from_env(name: &str) -> Option<Self> {
let name = name.to_uppercase();
let username = std::env::var(EnvVars::http_basic_username(&name)).ok();
let password = std::env::var(EnvVars::http_basic_password(&name)).ok();
let username = std::env::var(EnvVars::index_username(&name)).ok();
let password = std::env::var(EnvVars::index_password(&name)).ok();
if username.is_none() && password.is_none() {
None
} else {
Expand Down
14 changes: 4 additions & 10 deletions crates/uv-static/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ impl EnvVars {
pub const UV_STACK_SIZE: &'static str = "UV_STACK_SIZE";

/// 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")
pub fn index_username(name: &str) -> String {
format!("UV_INDEX_{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")
pub fn index_password(name: &str) -> String {
format!("UV_INDEX_{name}_PASSWORD")
}

/// Used to set the uv commit hash at build time via `build.rs`.
Expand All @@ -184,12 +184,6 @@ impl EnvVars {
/// 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";

/// 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.
pub const UV_INTERNAL__PARENT_INTERPRETER: &'static str = "UV_INTERNAL__PARENT_INTERPRETER";

Expand Down
4 changes: 2 additions & 2 deletions crates/uv/tests/it/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6479,8 +6479,8 @@ fn lock_env_credentials() -> Result<()> {

// Provide credentials via environment variables.
uv_snapshot!(context.filters(), context.lock()
.env(EnvVars::UV_HTTP_BASIC_PROXY_USERNAME, "public")
.env(EnvVars::UV_HTTP_BASIC_PROXY_PASSWORD, "heron"), @r###"
.env(EnvVars::index_username("PROXY"), "public")
.env(EnvVars::index_password("PROXY"), "heron"), @r###"
success: true
exit_code: 0
----- stdout -----
Expand Down