remove-openssl-dep #6

Merged
hatter merged 2 commits from remove-openssl-dep into master 2024-11-14 22:57:44 +08:00
4 changed files with 10 additions and 6 deletions
Showing only changes of commit c64f6a9836 - Show all commits

2
Cargo.lock generated
View File

@@ -874,7 +874,7 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]] [[package]]
name = "local-mini-kms" name = "local-mini-kms"
version = "0.3.8" version = "1.0.0"
dependencies = [ dependencies = [
"aes-gcm-stream", "aes-gcm-stream",
"aes-kw", "aes-kw",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "local-mini-kms" name = "local-mini-kms"
version = "0.3.8" version = "1.0.0"
edition = "2021" edition = "2021"
# 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

View File

@@ -138,7 +138,7 @@ async fn do_read(_arg_matches: &ArgMatches<'_>, sub_arg_matches: &ArgMatches<'_>
return simple_error!("Require key"); return simple_error!("Require key");
}; };
let data = do_inner_request(sub_arg_matches, "read", &body).await?; let data = do_inner_request(sub_arg_matches, "read", &body).await?;
success!("Value: {}", serde_json::to_string_pretty(&data)?); println!("{}", serde_json::to_string_pretty(&data)?);
Ok(Some(0)) Ok(Some(0))
} }

View File

@@ -31,6 +31,12 @@ impl DefaultCommandImpl {
} }
fn main() { fn main() {
if let Err(e) = inner_main() {
failure_and_exit!("Run local-mini-kms error: {}", e);
}
}
fn harden_process() {
let ignore_harden_process_error = std::env::var("IGNORE_HARDEN_PROCESS_ERROR") let ignore_harden_process_error = std::env::var("IGNORE_HARDEN_PROCESS_ERROR")
.map(|v| &v == "true").unwrap_or_else(|_| false); .map(|v| &v == "true").unwrap_or_else(|_| false);
match secmem_proc::harden_process() { match secmem_proc::harden_process() {
@@ -41,9 +47,6 @@ fn main() {
} }
Ok(_) => success!("Harden local-mini-kms success"), Ok(_) => success!("Harden local-mini-kms success"),
} }
if let Err(e) = inner_main() {
failure_and_exit!("Run local-mini-kms error: {}", e);
}
} }
fn inner_main() -> CommandError { fn inner_main() -> CommandError {
@@ -72,6 +75,7 @@ fn inner_main() -> CommandError {
let matches = app.get_matches(); let matches = app.get_matches();
for command in &commands { for command in &commands {
if let Some(sub_cmd_matches) = matches.subcommand_matches(command.name()) { if let Some(sub_cmd_matches) = matches.subcommand_matches(command.name()) {
if command.name() == "serve" { harden_process(); }
return command.run(&matches, sub_cmd_matches); return command.run(&matches, sub_cmd_matches);
} }
} }