Update dependencies

main
trivernis 1 year ago
parent 12eed6b967
commit cd4011014d
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

1
.gitignore vendored

@ -1 +1,2 @@
/target /target
.multihook.toml

896
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -11,35 +11,35 @@ repository = "https://github.com/Trivernis/multihook.git"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
thiserror = "1.0.26" thiserror = "1.0.40"
config = "0.11.0" config = "0.13.3"
lazy_static = "1.4.0" lazy_static = "1.4.0"
dirs = "3.0.2" dirs = "5.0.1"
toml = "0.5.8" toml = "0.7.4"
glob = "0.3.0" glob = "0.3.1"
log = "0.4.14" log = "0.4.19"
colored = "2.0.0" colored = "2.0.0"
chrono = "0.4.19" chrono = "0.4.26"
fern = "0.6.0" fern = "0.6.2"
serde_json = "1.0.66" serde_json = "1.0.97"
jsonpath = "0.1.1" jsonpath = "0.1.1"
regex = "1.5.4" regex = "1.8.4"
hmac = "0.11.0" hmac = "0.12.1"
sha2 = "0.9.5" sha2 = "0.10.7"
hex = "0.4.3" hex = "0.4.3"
[dependencies.serde] [dependencies.serde]
version = "1.0.127" version = "1.0.164"
features = ["derive"] features = ["derive"]
[dependencies.tokio] [dependencies.tokio]
version = "1.9.0" version = "1.28.2"
features = ["macros", "process", "sync"] features = ["macros", "process", "sync"]
[dependencies.hyper] [dependencies.hyper]
version = "0.14.11" version = "0.14.26"
features = ["server", "http1", "http2", "tcp"] features = ["server", "http1", "http2", "tcp"]
[features] [features]
default = ["tokio/rt-multi-thread"] default = ["tokio/rt-multi-thread"]
singlethreaded = ["tokio/rt"] singlethreaded = ["tokio/rt"]

@ -1,5 +1,5 @@
use crate::secret_validation::SecretValidator; use crate::secret_validation::SecretValidator;
use hmac::{Hmac, Mac, NewMac}; use hmac::{Hmac, Mac};
use hyper::HeaderMap; use hyper::HeaderMap;
use sha2::Sha256; use sha2::Sha256;
@ -19,7 +19,7 @@ impl SecretValidator for GithubSecretValidator {
} else { } else {
return false; return false;
}; };
mac.verify(&decoded_secret).is_ok() mac.verify_slice(&decoded_secret).is_ok()
} else { } else {
log::debug!("Missing Signature Header"); log::debug!("Missing Signature Header");
false false

@ -1,6 +1,6 @@
use crate::secret_validation::SecretFormat; use crate::secret_validation::SecretFormat;
use crate::utils::error::MultihookResult; use crate::utils::error::MultihookResult;
use config::File; use config::{Config, File};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::HashMap;
@ -64,27 +64,24 @@ fn load_settings() -> MultihookResult<Settings> {
)?; )?;
} }
let mut settings = config::Config::default(); let settings = Config::builder()
settings .add_source(
.merge(
glob::glob(&format!("{}/*.toml", config_dir.to_string_lossy())) glob::glob(&format!("{}/*.toml", config_dir.to_string_lossy()))
.unwrap() .unwrap()
.map(|path| File::from(path.unwrap())) .map(|path| File::from(path.unwrap()))
.collect::<Vec<_>>(), .collect::<Vec<_>>(),
)? )
.merge(config::Environment::with_prefix("MULTIHOOK"))?; .add_source(config::Environment::with_prefix("MULTIHOOK"))
.add_source(File::from(PathBuf::from(".multihook.toml")))
.build()?;
let settings: Settings = settings.try_into()?; let settings: Settings = settings.try_deserialize()?;
Ok(settings) Ok(settings)
} }
fn write_toml_pretty<T: Serialize>(path: &PathBuf, value: &T) -> MultihookResult<()> { fn write_toml_pretty<T: Serialize>(path: &PathBuf, value: &T) -> MultihookResult<()> {
let mut buf_str = String::new(); fs::write(path, toml::to_string_pretty(value)?)?;
let mut serializer = toml::Serializer::pretty(&mut buf_str);
serializer.pretty_array(true);
value.serialize(&mut serializer)?;
fs::write(path, buf_str.as_bytes())?;
Ok(()) Ok(())
} }

Loading…
Cancel
Save