fix: config empty values unset, drop adapter from_vars
This commit is contained in:
@@ -345,6 +345,27 @@ fn malformed_numeric_env_value_fails_naming_the_variable() {
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_env_value_falls_back_to_the_default() {
|
||||
Jail::expect_with(|jail| {
|
||||
jail_with(
|
||||
jail,
|
||||
&[
|
||||
("RATE_LIMIT", ""),
|
||||
("PORT", " "),
|
||||
("TMDB_API_KEY", ""),
|
||||
("NATS_URL", ""),
|
||||
],
|
||||
);
|
||||
let c = load().expect("empty values are unset, not errors");
|
||||
assert_eq!(c.server.rate_limit, 60);
|
||||
assert_eq!(c.server.port, 3000);
|
||||
assert!(c.metadata.tmdb_api_key.is_none());
|
||||
assert!(c.nats.url.is_none());
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn allow_registration_accepts_true_and_1_only() {
|
||||
for (value, expected) in [
|
||||
|
||||
Reference in New Issue
Block a user