From d26ddf87dff73bd3ef269ebb8f029ccb17656a76 Mon Sep 17 00:00:00 2001 From: Mason Gup Date: Fri, 7 Jun 2024 14:39:46 -0400 Subject: [PATCH] Improve crate dependencies --- Cargo.toml | 33 ++++++++++++++++----------------- src/config.rs | 12 ++++++------ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bd8a92c..4281e98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,26 +13,25 @@ keywords = ["security", "authentication", "web"] categories = ["authentication", "web-programming"] [dependencies] -reqwest = { version = ">= 0.11.23", features = ["json"] } -url = ">= 2.5.0" -serde = { version = ">= 1.0.85", features = ["derive"] } -serde_json = ">= 1.0.0" -serde_yaml = ">= 0.8.0" -uuid = { version = ">= 0.21.0", features = ["v4"] } -dirs = ">= 2.0.0" -chrono = ">= 0.4.0" -tokio = { version = ">= 1.0.1", features = ["fs"] } -hex = ">= 0.4.0" -bytes = ">= 1.0.0" -http = ">= 1.0.0" -tower = { version = ">= 0.4.13", optional = true } +reqwest = { version = "0.12", features = ["json"] } +url = "2" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +serde_yml = "0.0.10" +uuid = { version = "1", features = ["v4"] } +dirs = "5" +chrono = "0.4" +tokio = { version = "1", features = ["fs"] } +tower = { version = "0.4", optional = true } axum = { version = ">= 0.7.2", optional = true } -futures-core = { version = ">= 0.3.25", optional = true } -thiserror = ">= 1.0.37" +futures-core = { version = "0.3", optional = true } +http = { version = "1", optional = true } +bytes = { version = "1", optional = true } +thiserror = "1" mauth-core = "0.5" [dev-dependencies] -tokio = { version = ">= 1.0.1", features = ["rt-multi-thread", "macros"] } +tokio = { version = "1", features = ["rt-multi-thread", "macros"] } [features] -axum-service = ["tower", "futures-core", "axum"] +axum-service = ["tower", "futures-core", "axum", "http", "bytes"] diff --git a/src/config.rs b/src/config.rs index a40ad54..ed4d805 100644 --- a/src/config.rs +++ b/src/config.rs @@ -23,13 +23,13 @@ impl MAuthInfo { home.push(CONFIG_FILE); let config_data = std::fs::read_to_string(&home)?; - let config_data_value: serde_yaml::Value = - serde_yaml::from_slice(&config_data.into_bytes())?; + let config_data_value: serde_yml::Value = + serde_yml::from_slice(&config_data.into_bytes())?; let common_section = config_data_value .get("common") .ok_or(ConfigReadError::InvalidFile(None))?; let common_section_typed: ConfigFileSection = - serde_yaml::from_value(common_section.clone())?; + serde_yml::from_value(common_section.clone())?; Ok(common_section_typed) } @@ -102,7 +102,7 @@ pub enum ConfigReadError { #[error("File Read Error: {0}")] FileReadError(#[from] io::Error), #[error("Not a valid maudit config file: {0:?}")] - InvalidFile(Option), + InvalidFile(Option), #[error("MAudit URI not valid: {0}")] InvalidUri(#[from] url::ParseError), #[error("App UUID not valid: {0}")] @@ -124,8 +124,8 @@ impl From for ConfigReadError { } } -impl From for ConfigReadError { - fn from(err: serde_yaml::Error) -> ConfigReadError { +impl From for ConfigReadError { + fn from(err: serde_yml::Error) -> ConfigReadError { ConfigReadError::InvalidFile(Some(err)) } }