feat: final step in creating a new user

This commit is contained in:
silver 2023-06-04 19:39:01 +01:00
parent dcb4969b27
commit beab2cb97b
5 changed files with 135 additions and 14 deletions

View file

@ -65,6 +65,8 @@ pub struct State {
#[derive(Debug, Clone)]
pub struct Config {
ldap_host: String,
ldap_admin: String,
ldap_admin_pw: String,
pub database: String,
pub host_port: String,
}
@ -75,6 +77,8 @@ pub fn get_config() -> Config {
// reasonable defaults
let mut config = Config {
ldap_host: "".to_string(),
ldap_admin: "".to_string(),
ldap_admin_pw: "".to_string(),
database: "database.db".to_string(),
host_port: "127.0.0.1:8087".to_string(),
};
@ -82,6 +86,12 @@ pub fn get_config() -> Config {
if let Ok(x) = env::var("LDAP_HOST") {
config.ldap_host = x.trim().to_string();
}
if let Ok(x) = env::var("LDAP_ADMIN") {
config.ldap_admin = x.trim().to_string();
}
if let Ok(x) = env::var("LDAP_ADMIN_PW") {
config.ldap_admin_pw = x.trim().to_string();
}
if let Ok(x) = env::var("DATABASE") {
config.database = x.trim().to_string();
}