mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-05 16:12:44 +02:00
Code review issue: https://gitlab.com/keys.openpgp.org/hagrid/-/merge_requests/214#note_2484117659 Changes: - Extract database file path and log dir path constructions from Sqlite::new_file() and Sqlite::new_internal() associated functions to Sqlite::db_file_path() and Sqlite::log_dir_path(). These path manipulations inside Sqlite/KeyDatabase wasn't ideal as they increased diversity of reasons why Sqlite constructions can fail, unnecessary constrain how Sqlite and with which paths can be used, and that logic doesn't actually belong to Sqlite itself. So, later we probably have to move these db_file_path() and log_dir_path() functions else where. - Replace base_dir parameter of Sqlite::new_file() with "db_file" and "log_dir" params which gives us a way to use database file passed in command line options. - Add Sqlite::log_dir_path_from_db_file_path() associated function to infer log_dir_path based on given db_file_path. It is used in command handler where only db_file_path provided. - Pull up log dir construction from Sqlite::new_internal() to Sqlite::new_file() to avoid passing through log_dir_path through several functions. This also makes Sqlite::new_file() signature cleaner. - Fix usages of Sqlite/KeyDatabase::new_file through out the code base: and instead of providing base_dir, populate db_file_path and log_dir_path using Sqlite::db_file_path() and Sqlite::log_dir_path() functions which calculate paths based on provided base_dir. - Remove "-c, --config" and "-e, --environment" options from hagridctl::cli::Cli. - Remove hagridctl::cli::DeploymentEnvironment enum. - Remove entire hagridctl::config module as we don't extract paths from configuration any more. - Add "env" feature flag to "clap" dependency in hagridctl/Cargo.toml to be able to populate Cli::db_file_path field from HAGRID_DB_FILE_PATH environment variable. - Add optional --db-file-path option to "hagridctl". Cli::db_file_path is obligatory, but when --db-file-path is not provided Clap tries to populate it from HAGRID_DB_FILE_PATH env var and if that's not possible Clap terminates with error message. - In hagridctl::cli::dispatch_cmd() use db_file_path from cli.db_file_path instead of keys_internal_dir extracted from configuration. - Replace keys_db_internal_dir with db_file_path in the following command handlers: - hagridctl::delete::run - hagridctl::import::run - Get rid of unnecessary Result unwrapping and wrapping it again in hagrid::web::configure_db_service function and return the value from KeyDatabase::new_file immediately instead.
30 lines
929 B
TOML
30 lines
929 B
TOML
[package]
|
|
name = "hagridctl"
|
|
version = "0.1.0"
|
|
authors = ["Vincent Breitmoser <look@my.amazin.horse>"]
|
|
edition = "2024"
|
|
description = "Control hagrid database externally"
|
|
|
|
[dependencies]
|
|
hagrid-database = { workspace = true }
|
|
anyhow = { workspace = true }
|
|
sequoia-openpgp = { workspace = true, features = ["crypto-openssl"] }
|
|
multipart = { workspace = true }
|
|
log = { workspace = true }
|
|
rand = { workspace = true }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_derive = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
time = { workspace = true }
|
|
tempfile = { workspace = true }
|
|
url = { workspace = true }
|
|
hex = { workspace = true }
|
|
base64 = { workspace = true }
|
|
pathdiff = { workspace = true }
|
|
idna = { workspace = true }
|
|
fs2 = { workspace = true }
|
|
walkdir = { workspace = true }
|
|
clap = { workspace = true, features = ["derive", "unicode", "env"] }
|
|
toml = { workspace = true }
|
|
indicatif = { workspace = true }
|