feat: now get the users from teh env
This commit is contained in:
parent
ff282e823b
commit
114367d03a
1 changed files with 11 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
use std::collections::HashSet;
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use std::env;
|
||||
use dotenv::dotenv;
|
||||
use ldap3::{LdapConn, Mod};
|
||||
use tide::prelude::*;
|
||||
use skynet_ldap_server::{Config, get_config};
|
||||
|
@ -38,10 +39,16 @@ fn uid_to_dn(uid: &str) -> String{
|
|||
}
|
||||
|
||||
async fn update_admin(config: &Config) -> tide::Result<()>{
|
||||
let users = vec!["silver", "evanc", "eoghanconlon73"];
|
||||
dotenv().ok();
|
||||
|
||||
// read from teh env
|
||||
if let Ok(x) = env::var("USERS_ADMIN") {
|
||||
let users = x.split(',').collect::<Vec<&str>>();
|
||||
|
||||
update_group(config,"skynet-admins", &users, true).await?;
|
||||
// admins automatically get added as users
|
||||
update_group(config,"skynet-users", &users, false).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue