|
|
|
@ -194,7 +194,6 @@ pub struct Config {
|
|
|
|
|
pub output: OutputConfig, |
|
|
|
|
/// Download settings
|
|
|
|
|
#[clap(flatten)] |
|
|
|
|
#[serde(default)] |
|
|
|
|
pub http: HttpConfig, |
|
|
|
|
/// Specify configuration values using the provided TOML file, instead of
|
|
|
|
|
/// via command line flags. The values in the config file will override
|
|
|
|
@ -275,16 +274,6 @@ impl std::fmt::Debug for TargetRegistryConfig {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl Default for HttpConfig { |
|
|
|
|
fn default() -> Self { |
|
|
|
|
Self { |
|
|
|
|
user_agent: default_user_agent(), |
|
|
|
|
requests_per_second: default_requests_per_second(), |
|
|
|
|
max_concurrent_requests: default_max_concurrent_requests(), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
impl std::fmt::Debug for HttpConfig { |
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
|
|
|
|
f.debug_struct("Config") |
|
|
|
@ -381,14 +370,7 @@ async fn load_config_file(config: Config) -> Result<Config, AnyError> {
|
|
|
|
|
Some(path) => { |
|
|
|
|
debug!(?path, "loading config file"); |
|
|
|
|
let toml = tokio::fs::read_to_string(&path).await?; |
|
|
|
|
let config: Config = match toml::from_str(&toml) { |
|
|
|
|
Ok(c) => c, |
|
|
|
|
Err(e) => panic!( |
|
|
|
|
"\nfatal error: parsing config file at {} failed:\n\n{}\n\n", |
|
|
|
|
path.display(), |
|
|
|
|
e |
|
|
|
|
), |
|
|
|
|
}; |
|
|
|
|
let config: Config = toml::from_str(&toml)?; |
|
|
|
|
Ok(config) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|