Skip to content

Commit

Permalink
Attempt to use the PAT from the URL if provided
Browse files Browse the repository at this point in the history
  • Loading branch information
DrChat committed Sep 29, 2022
1 parent fb51b64 commit 3072640
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/symsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,13 @@ fn connect_server(srv: &SymSrv) -> anyhow::Result<reqwest::Client> {
match d {
// Azure DevOps
d if d.ends_with("artifacts.visualstudio.com") => {
let pat = std::env::var("ADO_PAT").context("var ADO_PAT is not defined!")?;
// Try and find the PAT for ADO, either from basic authentication or an ADO_PAT
// environment variable.
let pat = url
.password()
.map(|p| p.to_string())
.or(std::env::var("ADO_PAT").ok())
.context("PAT not specified for ADO")?;
if url.scheme() != "https" {
anyhow::bail!("This URL must be over https!");
}
Expand Down

0 comments on commit 3072640

Please sign in to comment.