mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
auth: configparser::ConfigSet -> configmodel::Config
Summary: The latter is more lightweight. Reviewed By: DurhamG Differential Revision: D27641669 fbshipit-source-id: d907407f5a6e868862fe37f1f67fbe99ee378156
This commit is contained in:
parent
cb58689d67
commit
0d764cf718
@ -56,7 +56,7 @@ fn getauth(
|
||||
.map_pyerr(py)?;
|
||||
}
|
||||
|
||||
AuthSection::from_config(&cfg)
|
||||
AuthSection::from_config(cfg)
|
||||
.validate(validate)
|
||||
.best_match_for(&uri)
|
||||
.map_pyerr(py)?
|
||||
|
@ -7,7 +7,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
configparser = { path = "../configparser" }
|
||||
configmodel = { path = "../configmodel" }
|
||||
indexmap = { version = "1.6", features = ["rayon", "serde-1"] }
|
||||
pem = "0.8"
|
||||
simple_asn1 = "0.4"
|
||||
@ -16,4 +16,5 @@ url = "2.1.0"
|
||||
util = { path = "../util" }
|
||||
|
||||
[dev-dependencies]
|
||||
configparser = { path = "../configparser" }
|
||||
once_cell = "1.4"
|
||||
|
@ -11,7 +11,7 @@ use anyhow::{Error, Result};
|
||||
use indexmap::IndexMap;
|
||||
use url::Url;
|
||||
|
||||
use configparser::{config::ConfigSet, Text};
|
||||
use configmodel::{Config, Text};
|
||||
use util::path::expand_path;
|
||||
|
||||
pub mod x509;
|
||||
@ -113,7 +113,7 @@ impl AuthSection {
|
||||
///
|
||||
/// Values are parsed `Auth` structs containing all of the values
|
||||
/// found for the given grouping.
|
||||
pub fn from_config(config: &ConfigSet) -> Self {
|
||||
pub fn from_config(config: &dyn Config) -> Self {
|
||||
// Use an IndexMap to preserve ordering; needed to correctly handle precedence.
|
||||
let mut groups = IndexMap::new();
|
||||
|
||||
@ -265,6 +265,7 @@ fn strip_scheme_and_user(url: &Url) -> String {
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
use configparser::config::ConfigSet;
|
||||
use configparser::config::Options;
|
||||
|
||||
#[test]
|
||||
|
@ -64,7 +64,7 @@ impl Builder {
|
||||
.map_err(|e| ConfigError::Malformed("edenapi.validate-certs".into(), e))?
|
||||
.unwrap_or_default();
|
||||
|
||||
let (cert, key, ca_bundle) = AuthSection::from_config(&config)
|
||||
let (cert, key, ca_bundle) = AuthSection::from_config(config)
|
||||
.validate(validate_certs)
|
||||
.best_match_for(&server_url)?
|
||||
.map(|auth| (auth.cert, auth.key, auth.cacerts))
|
||||
|
@ -1347,7 +1347,7 @@ impl LfsRemote {
|
||||
}
|
||||
|
||||
let auth = if config.get_or("lfs", "use-client-certs", || true)? {
|
||||
AuthSection::from_config(&config).best_match_for(&url)?
|
||||
AuthSection::from_config(config).best_match_for(&url)?
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user