chore: Fix default attributes for config

This commit is contained in:
Jade Ellis 2025-08-10 20:49:08 +01:00 committed by Ellis Git
commit c58b9f05ed
2 changed files with 14 additions and 10 deletions

View file

@ -1797,7 +1797,7 @@
# #
# example: "ou=users,dc=example,dc=org" # example: "ou=users,dc=example,dc=org"
# #
#base_dn = #base_dn = ""
# Bind DN if anonymous search is not enabled. # Bind DN if anonymous search is not enabled.
# #
@ -1846,7 +1846,7 @@
# #
# example: "ou=admins,dc=example,dc=org" # example: "ou=admins,dc=example,dc=org"
# #
#admin_base_dn = #admin_base_dn = ""
# The LDAP search filter to find administrative users for continuwuity. # The LDAP search filter to find administrative users for continuwuity.
# #

View file

@ -2063,7 +2063,9 @@ pub struct LdapConfig {
/// Root of the searches. /// Root of the searches.
/// ///
/// example: "ou=users,dc=example,dc=org" /// example: "ou=users,dc=example,dc=org"
#[serde(default = "empty_string_fn")] ///
/// default: ""
#[serde(default)]
pub base_dn: String, pub base_dn: String,
/// Bind DN if anonymous search is not enabled. /// Bind DN if anonymous search is not enabled.
@ -2076,7 +2078,9 @@ pub struct LdapConfig {
/// ///
/// example: "cn=ldap-reader,dc=example,dc=org" or /// example: "cn=ldap-reader,dc=example,dc=org" or
/// "cn={username},ou=users,dc=example,dc=org" /// "cn={username},ou=users,dc=example,dc=org"
#[serde(default = "some_empty_string_fn")] ///
/// default:
#[serde(default)]
pub bind_dn: Option<String>, pub bind_dn: Option<String>,
/// Path to a file on the system that contains the password for the /// Path to a file on the system that contains the password for the
@ -2118,7 +2122,9 @@ pub struct LdapConfig {
/// Defaults to `base_dn` if empty. /// Defaults to `base_dn` if empty.
/// ///
/// example: "ou=admins,dc=example,dc=org" /// example: "ou=admins,dc=example,dc=org"
#[serde(default = "empty_string_fn")] ///
/// default: ""
#[serde(default)]
pub admin_base_dn: String, pub admin_base_dn: String,
/// The LDAP search filter to find administrative users for continuwuity. /// The LDAP search filter to find administrative users for continuwuity.
@ -2130,7 +2136,9 @@ pub struct LdapConfig {
/// entered username for more complex filters. /// entered username for more complex filters.
/// ///
/// example: "(objectClass=conduwuitAdmin)" or "(uid={username})" /// example: "(objectClass=conduwuitAdmin)" or "(uid={username})"
#[serde(default = "empty_string_fn")] ///
/// default:
#[serde(default)]
pub admin_filter: String, pub admin_filter: String,
} }
@ -2232,10 +2240,6 @@ impl Config {
fn true_fn() -> bool { true } fn true_fn() -> bool { true }
fn empty_string_fn() -> String { String::new() }
fn some_empty_string_fn() -> Option<String> { Some(String::new()) }
fn default_address() -> ListeningAddr { fn default_address() -> ListeningAddr {
ListeningAddr { ListeningAddr {
addrs: Right(vec![Ipv4Addr::LOCALHOST.into(), Ipv6Addr::LOCALHOST.into()]), addrs: Right(vec![Ipv4Addr::LOCALHOST.into(), Ipv6Addr::LOCALHOST.into()]),