feat: v1.0.0, opt cli
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -31,6 +31,12 @@ impl DefaultCommandImpl {
|
||||
}
|
||||
|
||||
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")
|
||||
.map(|v| &v == "true").unwrap_or_else(|_| false);
|
||||
match secmem_proc::harden_process() {
|
||||
@@ -41,9 +47,6 @@ fn main() {
|
||||
}
|
||||
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 {
|
||||
@@ -72,6 +75,7 @@ fn inner_main() -> CommandError {
|
||||
let matches = app.get_matches();
|
||||
for command in &commands {
|
||||
if let Some(sub_cmd_matches) = matches.subcommand_matches(command.name()) {
|
||||
if command.name() == "serve" { harden_process(); }
|
||||
return command.run(&matches, sub_cmd_matches);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user