feat(server): add clap-derive Config (args + env)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 00:46:31 +02:00
parent b9b99c0332
commit 08e5f797f8
3 changed files with 42 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
use clap::Parser;
use server::Config;
#[test]
fn parses_from_args_with_defaults() {
let cfg = Config::try_parse_from(["server", "--database-url", "postgres://localhost/test"])
.expect("should parse");
assert_eq!(cfg.database_url, "postgres://localhost/test");
assert_eq!(cfg.bind_addr, "0.0.0.0:8080");
assert_eq!(cfg.app_name, "Collection Management System");
}
#[test]
fn database_url_is_required() {
assert!(Config::try_parse_from(["server"]).is_err());
}