feat: v0.3.7, yubikey is optional

This commit is contained in:
2024-11-10 18:38:56 +08:00
parent 8918d1d59b
commit ec7aaa9fca
6 changed files with 28 additions and 6 deletions

View File

@@ -1,18 +1,20 @@
use clap::{App, AppSettings, ArgMatches};
use rust_util::{failure_and_exit, information, success, warning};
use rust_util::util_clap::{Command, CommandError};
use rust_util::{failure_and_exit, information, success, warning};
mod db;
mod proc;
mod jose;
mod cli;
mod yubikey_hmac;
mod serve;
mod serve_common;
mod serve_status;
mod serve_init;
mod serve_encrypt_decrypt;
mod serve_read_write;
#[cfg(feature = "yubikey")]
mod yubikey_hmac;
#[cfg(feature = "yubikey")]
mod yubikey_init_master_key;
mod serve_datakey;
@@ -48,12 +50,17 @@ fn inner_main() -> CommandError {
let commands: Vec<Box<dyn Command>> = vec![
Box::new(cli::CommandImpl),
Box::new(serve::CommandImpl),
#[cfg(feature = "yubikey")]
Box::new(yubikey_init_master_key::CommandImpl),
];
let mut features: Vec<String> = vec![];
#[cfg(feature = "yubikey")]
features.push("yubikey".to_string());
let long_about = format!("Local mini KMS, features: [{}]", features.join(", "));
let mut app = App::new(env!("CARGO_PKG_NAME"))
.version(env!("CARGO_PKG_VERSION"))
.about(env!("CARGO_PKG_DESCRIPTION"))
.long_about("Local mini KMS")
.long_about(long_about.as_str())
.setting(AppSettings::ColoredHelp);
app = DefaultCommandImpl::process_command(app);
for command in &commands {