mirror of
https://github.com/bitwarden/server
synced 2026-01-31 00:33:17 +00:00
Use Bitwarden configuration in AKD test utility
This commit is contained in:
2
akd/Cargo.lock
generated
2
akd/Cargo.lock
generated
@@ -113,6 +113,7 @@ dependencies = [
|
||||
"akd_storage",
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bitwarden-akd-configuration",
|
||||
"clap",
|
||||
"hex",
|
||||
"owo-colors",
|
||||
@@ -120,6 +121,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -12,7 +12,7 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
akd = { workspace = true }
|
||||
akd_storage = { workspace = true}
|
||||
akd_storage = { workspace = true }
|
||||
anyhow = "1"
|
||||
async-trait = { workspace = true }
|
||||
clap = { version = "4", features = ["derive"] }
|
||||
@@ -21,7 +21,13 @@ owo-colors = "4"
|
||||
rand = "0.8"
|
||||
tokio.workspace = true
|
||||
tracing.workspace = true
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt", "ansi"] }
|
||||
tracing-subscriber = { workspace = true, features = [
|
||||
"env-filter",
|
||||
"fmt",
|
||||
"ansi",
|
||||
] }
|
||||
bitwarden-akd-configuration = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -18,7 +18,8 @@ use tracing_subscriber::Layer;
|
||||
mod commands;
|
||||
mod directory_host;
|
||||
|
||||
type TC = akd::ExperimentalConfiguration<akd::ExampleLabel>;
|
||||
// type TC = akd::ExperimentalConfiguration<akd::ExampleLabel>;
|
||||
type TC = bitwarden_akd_configuration::BitwardenV1Configuration;
|
||||
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
enum LogLevel {
|
||||
@@ -73,6 +74,10 @@ struct CliArgs {
|
||||
#[clap(long = "connection-string", short = 'c')]
|
||||
connection_string: Option<String>,
|
||||
|
||||
/// Installation context UUID (also reads from AKD_INSTALLATION_CONTEXT env var)
|
||||
#[clap(long = "installation-context", short = 'i')]
|
||||
installation_context: Option<String>,
|
||||
|
||||
/// Log level
|
||||
#[clap(
|
||||
value_enum,
|
||||
@@ -115,9 +120,22 @@ async fn main() -> Result<()> {
|
||||
.or_else(|| std::env::var("AKD_MSSQL_CONNECTION_STRING").ok())
|
||||
.context("Connection string required via --connection-string or AKD_MSSQL_CONNECTION_STRING env var")?;
|
||||
|
||||
// Get installation context from CLI or env var
|
||||
let installation_context_str = args
|
||||
.installation_context
|
||||
.clone()
|
||||
.or_else(|| std::env::var("AKD_INSTALLATION_CONTEXT").ok())
|
||||
.context("Installation context UUID required via --installation-context or AKD_INSTALLATION_CONTEXT env var")?;
|
||||
|
||||
// Parse installation context as UUID
|
||||
let installation_context = uuid::Uuid::parse_str(&installation_context_str)
|
||||
.context("Installation context must be a valid UUID")?;
|
||||
|
||||
// Initialize logging
|
||||
let mut layers = Vec::new();
|
||||
|
||||
bitwarden_akd_configuration::BitwardenV1Configuration::init(installation_context);
|
||||
|
||||
// If a log file is specified, only log to file
|
||||
// Otherwise, log to console
|
||||
if let Some(ref log_file) = args.log_file {
|
||||
|
||||
Reference in New Issue
Block a user