mirror of
https://github.com/SeriousBug/gandi-live-dns-rust
synced 2024-05-18 11:19:03 -05:00
made code more concise
This commit is contained in:
parent
283cb589bd
commit
87c457a83e
|
@ -72,7 +72,7 @@ pub fn load_config(opts: &opts::Opts) -> anyhow::Result<Config> {
|
||||||
Some(config_path) => load_config_from(config_path),
|
Some(config_path) => load_config_from(config_path),
|
||||||
None => {
|
None => {
|
||||||
let confpath = ProjectDirs::from("me", "kaangenc", "gandi-dynamic-dns")
|
let confpath = ProjectDirs::from("me", "kaangenc", "gandi-dynamic-dns")
|
||||||
.and_then(|dir| Some(PathBuf::from(dir.config_dir()).join("config.toml")))
|
.map(|dir| PathBuf::from(dir.config_dir()).join("config.toml"))
|
||||||
.ok_or(anyhow::anyhow!("Can't find config directory"));
|
.ok_or(anyhow::anyhow!("Can't find config directory"));
|
||||||
confpath
|
confpath
|
||||||
.and_then(|path| {
|
.and_then(|path| {
|
||||||
|
@ -92,11 +92,9 @@ pub fn load_config(opts: &opts::Opts) -> anyhow::Result<Config> {
|
||||||
.entry
|
.entry
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|mut entry| {
|
.map(|mut entry| {
|
||||||
entry.types = entry
|
entry
|
||||||
.types
|
.types
|
||||||
.into_iter()
|
.retain(|v| (v == "A" && !opts.skip_ipv4) || (v == "AAAA" && !opts.skip_ipv6));
|
||||||
.filter(|v| (v == "A" && !opts.skip_ipv4) || (v == "AAAA" && !opts.skip_ipv6))
|
|
||||||
.collect();
|
|
||||||
entry
|
entry
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
Loading…
Reference in a new issue