server: make host configurable to enable IPv6 support

This change also separates the API host and the LDAP host for further customization.
This commit is contained in:
Waldemar Heinze
2022-11-24 23:39:11 +01:00
committed by GitHub
parent dd7e392626
commit 2668ea4553
5 changed files with 59 additions and 27 deletions

View File

@@ -177,7 +177,7 @@ where
info!("Starting the LDAP server on port {}", config.ldap_port);
let server_builder = server_builder
.bind("ldap", ("0.0.0.0", config.ldap_port), binder)
.bind("ldap", (config.ldap_host.clone(), config.ldap_port), binder)
.with_context(|| format!("while binding to the port {}", config.ldap_port));
if config.ldaps_options.enabled {
let tls_context = (
@@ -212,8 +212,12 @@ where
config.ldaps_options.port
);
server_builder.and_then(|s| {
s.bind("ldaps", ("0.0.0.0", config.ldaps_options.port), tls_binder)
.with_context(|| format!("while binding to the port {}", config.ldaps_options.port))
s.bind(
"ldaps",
(config.ldap_host.clone(), config.ldaps_options.port),
tls_binder,
)
.with_context(|| format!("while binding to the port {}", config.ldaps_options.port))
})
} else {
server_builder