From 9ec515d0bf260622c679f73b12db64eda860643a Mon Sep 17 00:00:00 2001
From: Mario Voigt <mario.voigt@stadtfabrikanten.org>
Date: Tue, 18 Feb 2025 11:44:47 +0100
Subject: [PATCH] synchronize default values with documentation; add more
 precise help descriptions

---
 bffhd/config/dhall.rs |  8 ++++----
 bin/bffhd/main.rs     | 25 ++++++++++++++-----------
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/bffhd/config/dhall.rs b/bffhd/config/dhall.rs
index 557cd49..51101d4 100644
--- a/bffhd/config/dhall.rs
+++ b/bffhd/config/dhall.rs
@@ -152,13 +152,13 @@ impl Default for Config {
             actor_connections: vec![("Testmachine".to_string(), "Actor".to_string())],
             init_connections: vec![("Initiator".to_string(), "Testmachine".to_string())],
 
-            db_path: PathBuf::from("/run/bffh/database"),
-            auditlog_path: PathBuf::from("/var/log/bffh/audit.log"),
+            db_path: PathBuf::from("/var/lib/bffh/bffh.db"),
+            auditlog_path: PathBuf::from("/var/log/bffh/audit.json"),
             roles: HashMap::new(),
 
             tlsconfig: TlsListen {
-                certfile: PathBuf::from("./bffh.crt"),
-                keyfile: PathBuf::from("./bffh.key"),
+                certfile: PathBuf::from("/etc/bffh/certs/bffh.crt"),
+                keyfile: PathBuf::from("/etc/bffh/certs//bffh.key"),
                 ..Default::default()
             },
 
diff --git a/bin/bffhd/main.rs b/bin/bffhd/main.rs
index a3e64b3..5eb1d38 100644
--- a/bin/bffhd/main.rs
+++ b/bin/bffhd/main.rs
@@ -23,12 +23,12 @@ fn main() -> miette::Result<()> {
             build_kind=difluoroborane::env::BUILD_RUST_CHANNEL))
         .about(clap::crate_description!())
         .arg(Arg::new("config")
-                .help("Path to the config file to use")
+                .help("Path to the DHALL config file to use")
                 .long("config")
                 .short('c')
                 .takes_value(true))
         .arg(Arg::new("verbosity")
-            .help("Increase logging verbosity")
+            .help("Increase logging verbosity. Stackable from -v up to -vvv")
             .long("verbose")
             .short('v')
             .multiple_occurrences(true)
@@ -47,18 +47,19 @@ fn main() -> miette::Result<()> {
         .arg(Arg::new("log level")
             .help("Set the desired log levels.")
             .long("log-level")
-            .takes_value(true))
+            .takes_value(true)
+            .possible_values(["info", "warn", "error", "debug", "trace"]))
         .arg(
             Arg::new("print default")
-                .help("Print a default config to stdout instead of running")
+                .help("Print a default DHALL config to stdout instead of running")
                 .long("print-default"))
         .arg(
             Arg::new("check config")
-                .help("Check config for validity")
+                .help("Check DHALL config for validity")
                 .long("check"))
         .arg(
             Arg::new("dump-db")
-                .help("Dump all internal databases")
+                .help("Dump all internal databases (states and users) to the given file as TOML")
                 .long("dump-db")
                 .alias("dump")
                 .conflicts_with("dump-users")
@@ -83,29 +84,31 @@ fn main() -> miette::Result<()> {
                 )
         .arg(
             Arg::new("force")
-                .help("force ops that may clobber")
+                .help("Force owerwriting existing files")
                 .long("force")
         )
         .arg(
             Arg::new("load-users")
-                .help("Load users into the internal databases")
+                .help("Load users from TOML into the internal databases")
                 .long("load-users")
                 .alias("load")
                 .takes_value(true)
+                .value_name("FILE")
                 .conflicts_with("dump-db")
                 .conflicts_with("load-db")
                 .conflicts_with("dump-users")
                 )
         .arg(
             Arg::new("load-db")
-                .help("Load values into the internal databases")
+                .help("Load values from TOML into the internal databases")
                 .long("load-db")
                 .takes_value(true)
+                .value_name("FILE")
                 .conflicts_with("dump-db")
                 .conflicts_with("load-users")
                 .conflicts_with("dump-users"))
         .arg(Arg::new("keylog")
-            .help("log TLS keys into PATH. If no path is specified the value of the envvar SSLKEYLOGFILE is used.")
+            .help("Log TLS keys into PATH. If no path is specified the value of the envvar SSLKEYLOGFILE is used.")
             .long("tls-key-log")
             .value_name("PATH")
             .takes_value(true)
@@ -121,7 +124,7 @@ fn main() -> miette::Result<()> {
 
     let configpath = matches
         .value_of("config")
-        .unwrap_or("/etc/difluoroborane.dhall");
+        .unwrap_or("/etc/bffh/bffh.dhall");
 
     // Check for the --print-default option first because we don't need to do anything else in that
     // case.