diff --git a/Cargo.toml b/Cargo.toml index 5f76dea..310a48c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,4 @@ edition = "2018" [dependencies] ureq = "1.1.1" +uuid = { version = "0.8.1", default-features = false, features = [ "v1" ] } diff --git a/src/config.rs b/src/config.rs index 741ec35..07c7d01 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,9 +1,15 @@ +use uuid::Uuid; + pub struct HealthcheckConfig { pub uuid: String, } pub fn create_config(uuid: &str) -> HealthcheckConfig { - HealthcheckConfig { - uuid: uuid.to_string(), + if let Ok(_) = Uuid::parse_str(uuid) { + HealthcheckConfig { + uuid: uuid.to_string(), + } + } else { + panic!("Invalid UUID: {}", uuid) } }