Fix parsing errors with config options (#632)

This commit is contained in:
Matthias 2022-05-31 19:43:46 +02:00 committed by GitHub
parent d48a3279a8
commit 9b4dfadffd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 8 deletions

11
Cargo.lock generated
View file

@ -1450,6 +1450,16 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "humantime-serde"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c"
dependencies = [
"humantime",
"serde",
]
[[package]]
name = "hyper"
version = "0.14.19"
@ -1745,6 +1755,7 @@ dependencies = [
"headers",
"http",
"humantime",
"humantime-serde",
"indicatif",
"log",
"lychee-lib",

View file

@ -17,8 +17,7 @@ no_progress = true
cache = false
# Discard all cached requests older than this duration.
# Error: invalid type: string "2d", expected struct Duration for key `max_cache_age`
# max_cache_age = "2d"
max_cache_age = "2d"
############################# Runtime #############################
@ -69,8 +68,7 @@ headers = []
remap = [ "https://example.com http://example.invalid" ]
# Base URL or website root directory to check relative URLs.
# Error: invalid type: unit variant, expected newtype variant for key `base`
# base = "https://example.com"
base = "https://example.com"
# HTTP basic auth support. This will be the username and password passed to the
# authorization HTTP header. See

View file

@ -45,6 +45,7 @@ once_cell = "1.12.0"
dashmap = { version = "5.3.4", features = ["serde"] }
csv = "1.1.6"
humantime = "2.1.0"
humantime-serde = "1.1.1"
secrecy = { version = "0.8.0", features = ["serde"] }
supports-color = "1.3.0"
log = "0.4.17"

View file

@ -165,6 +165,7 @@ pub(crate) struct Config {
default_value = &MAX_CACHE_AGE_STR
)]
#[serde(default = "max_cache_age")]
#[serde(with = "humantime_serde")]
pub(crate) max_cache_age: Duration,
/// Don't perform any link checking.

View file

@ -9,6 +9,7 @@ use crate::{ErrorKind, InputSource};
/// Both, local and remote targets are supported.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
#[allow(variant_size_differences)]
#[serde(try_from = "&str")]
pub enum Base {
/// Local file path pointing to root directory
Local(PathBuf),

View file

@ -16,8 +16,7 @@ output = "report.md"
cache = true
# Discard all cached requests older than this duration.
# Error: invalid type: string "2d", expected struct Duration for key `max_cache_age`
# max_cache_age = "2d"
max_cache_age = "2d"
############################# Runtime #############################
@ -68,8 +67,7 @@ headers = []
remap = [ "https://example.com http://example.invalid" ]
# Base URL or website root directory to check relative URLs.
# Error: invalid type: unit variant, expected newtype variant for key `base`
# base = "https://example.com"
base = "https://example.com"
# HTTP basic auth support. This will be the username and password passed to the
# authorization HTTP header. See