feat(server): add clap-derive Config (args + env)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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());
|
||||
}
|
||||
Reference in New Issue
Block a user