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
.multihook.toml

896
Cargo.lock generated

File diff suppressed because it is too large Load Diff

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

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

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

Loading…
Cancel
Save