m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-08 05:03:49 -05:00

3 Commits

Author SHA1 Message Date
Sergio
b542f1bac5 chore: bump project version 2025-05-27 14:51:48 +03:00
Sergio
34ae9cb36f fix: ignore empty refresh interval 2025-05-27 14:51:48 +03:00
Sergio
e015afbaca chore: update project version in Cargo.lock
This should have happened automatically when Cargo.toml was updated
2025-05-27 14:51:13 +03:00
3 changed files with 16 additions and 2 deletions

2
Cargo.lock generated
View File

@@ -376,7 +376,7 @@ dependencies = [
[[package]]
name = "cup"
version = "3.3.0"
version = "3.4.1"
dependencies = [
"bollard",
"chrono",

View File

@@ -1,6 +1,6 @@
[package]
name = "cup"
version = "3.4.0"
version = "3.4.1"
edition = "2021"
[dependencies]

View File

@@ -1,5 +1,6 @@
use rustc_hash::FxHashMap;
use serde::Deserialize;
use serde::Deserializer;
use std::env;
use std::mem;
use std::path::PathBuf;
@@ -64,6 +65,7 @@ pub struct Config {
pub agent: bool,
pub ignore_update_type: UpdateType,
pub images: ImageConfig,
#[serde(deserialize_with = "empty_as_none")]
pub refresh_interval: Option<String>,
pub registries: FxHashMap<String, RegistryConfig>,
pub servers: FxHashMap<String, String>,
@@ -151,3 +153,15 @@ impl Default for Config {
Self::new()
}
}
fn empty_as_none<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
where
D: Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
if s.is_empty() {
Ok(None)
} else {
Ok(Some(s))
}
}