From 9e37a06514b821975dc49de74078322d9238d230 Mon Sep 17 00:00:00 2001 From: Frank Moskal Date: Wed, 13 Jul 2022 08:32:35 -0400 Subject: [PATCH] server: allow admin email to be set via config --- lldap_config.docker_template.toml | 5 +++++ server/src/infra/configuration.rs | 2 ++ server/src/main.rs | 1 + 3 files changed, 8 insertions(+) diff --git a/lldap_config.docker_template.toml b/lldap_config.docker_template.toml index cb2715e..c579b8a 100644 --- a/lldap_config.docker_template.toml +++ b/lldap_config.docker_template.toml @@ -45,6 +45,11 @@ ## For the administration interface, this is the username. #ldap_user_dn = "admin" +## Admin email. +## Email for the admin account. It is only used when initially creating +## the admin user, and can safely be omitted. +#ldap_user_email = "admin@example.com" + ## Admin password. ## Password for the admin account, both for the LDAP bind and for the ## administration interface. It is only used when initially creating diff --git a/server/src/infra/configuration.rs b/server/src/infra/configuration.rs index 4b751b0..687c3e8 100644 --- a/server/src/infra/configuration.rs +++ b/server/src/infra/configuration.rs @@ -71,6 +71,8 @@ pub struct Configuration { pub ldap_base_dn: String, #[builder(default = r#"UserId::new("admin")"#)] pub ldap_user_dn: UserId, + #[builder(default = r#"String::default()"#)] + pub ldap_user_email: String, #[builder(default = r#"SecUtf8::from("password")"#)] pub ldap_user_pass: SecUtf8, #[builder(default = r#"String::from("sqlite://users.db?mode=rwc")"#)] diff --git a/server/src/main.rs b/server/src/main.rs index b30ebc0..27eafae 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -30,6 +30,7 @@ async fn create_admin_user(handler: &SqlBackendHandler, config: &Configuration) handler .create_user(CreateUserRequest { user_id: config.ldap_user_dn.clone(), + email: config.ldap_user_email.clone(), display_name: Some("Administrator".to_string()), ..Default::default() })