chore: change verbose to isize, only println if verbose > 0 (env WEB_SERVER_VERBOSE)
This commit is contained in:
parent
b5685bbe40
commit
ad0664c90b
5 changed files with 26 additions and 18 deletions
|
|
@ -97,10 +97,10 @@ pub struct AuthStore {
|
|||
|
||||
impl AuthStore {
|
||||
#[must_use]
|
||||
pub fn new(config: &WebServer, enforcer: SharedEnforcer,verbose: &str) -> Self {
|
||||
pub fn new(config: &WebServer, enforcer: SharedEnforcer,verbose: isize) -> Self {
|
||||
Self {
|
||||
users: Arc::new(RwLock::new(AuthStore::create_user_map(config,&verbose))),
|
||||
shadows: Arc::new(RwLock::new(AuthStore::create_shadows_map(config,&verbose))),
|
||||
users: Arc::new(RwLock::new(AuthStore::create_user_map(config,verbose))),
|
||||
shadows: Arc::new(RwLock::new(AuthStore::create_shadows_map(config,verbose))),
|
||||
sessions: Arc::new(RwLock::new(HashMap::new())),
|
||||
enforcer,
|
||||
}
|
||||
|
|
@ -136,13 +136,13 @@ impl AuthStore {
|
|||
shadows
|
||||
}
|
||||
#[must_use]
|
||||
pub fn create_user_map(config: &WebServer,verbose: &str) -> HashMap<String, User> {
|
||||
pub fn create_user_map(config: &WebServer,verbose: isize) -> HashMap<String, User> {
|
||||
// TODO load form YAML o CONFIG
|
||||
let mut usrs = HashMap::new();
|
||||
match config.usrs_store.as_str() {
|
||||
"fs" => {
|
||||
usrs = AuthStore::load_users_from_fs(&config.usrs_store,&config.usrs_store_target);
|
||||
if !usrs.is_empty() && verbose != "quiet" {
|
||||
if !usrs.is_empty() && verbose > 0 {
|
||||
println!("Users loaded successfully ({})", &usrs.len());
|
||||
}
|
||||
},
|
||||
|
|
@ -151,13 +151,13 @@ impl AuthStore {
|
|||
usrs
|
||||
}
|
||||
#[must_use]
|
||||
pub fn create_shadows_map(config: &WebServer,verbose: &str) -> HashMap<String, UserShadow> {
|
||||
pub fn create_shadows_map(config: &WebServer,verbose: isize) -> HashMap<String, UserShadow> {
|
||||
// TODO load form YAML o CONFIG
|
||||
let mut shadows = HashMap::new();
|
||||
match config.usrs_shadow_store.as_str() {
|
||||
"fs" => {
|
||||
shadows = AuthStore::load_shadows_from_fs(&config.usrs_shadow_store,&config.usrs_shadow_target);
|
||||
if !shadows.is_empty() && verbose != "quiet" {
|
||||
if !shadows.is_empty() && verbose > 0 {
|
||||
println!("Users info successfully ({})",&shadows.len());
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue