diff --git a/src/apps/app_data.rs b/src/apps/app_data.rs index 292465b..ebfd3b6 100644 --- a/src/apps/app_data.rs +++ b/src/apps/app_data.rs @@ -286,6 +286,7 @@ pub struct ContainerState { pub port: Option, pub started_at: Option>, pub used_registry: Option, + pub basic_auth: Option<(String, String)>, } impl Default for ContainerState { @@ -299,6 +300,7 @@ impl Default for ContainerState { port: None, started_at: None, used_registry: None, + basic_auth: None, } } } @@ -468,6 +470,7 @@ impl AppData { ..AppSettings::default() }; + let mut basic_auth = None; // Iterate over services and add them to the new settings for service in &self.services { if !service.domains.is_empty() { @@ -477,8 +480,13 @@ impl AppData { domains: service.domains.clone(), }); } + if service.basic_auth.is_some() { + basic_auth = service.basic_auth.clone(); + } } + new_settings.basic_auth = basic_auth; + let app_data = AppData { settings: Some(new_settings), ..self.clone() diff --git a/src/docker/find_apps.rs b/src/docker/find_apps.rs index 2c0e79a..63c2165 100644 --- a/src/docker/find_apps.rs +++ b/src/docker/find_apps.rs @@ -164,6 +164,7 @@ async fn get_running_services( port: None, started_at: None, used_registry: None, + basic_auth: None, } } }) @@ -285,6 +286,13 @@ async fn inspect_docker_container( port: loadbalancer_info.port, started_at: Some(local_date), used_registry, + basic_auth: match ( + loadbalancer_info.basic_auth_user, + loadbalancer_info.basic_auth_pass, + ) { + (Some(user), Some(pass)) => Some((user, pass)), + _ => None, + }, }; Ok(container_state) diff --git a/src/docker/loadbalancer.rs b/src/docker/loadbalancer.rs index 9cd08e5..c6eb0ef 100644 --- a/src/docker/loadbalancer.rs +++ b/src/docker/loadbalancer.rs @@ -13,8 +13,8 @@ pub struct LoadBalancerInfo { pub domains: Vec, pub port: Option, pub tls_enabled: bool, - pub http_auth_user: Option, - pub http_auth_pass: Option, + pub basic_auth_user: Option, + pub basic_auth_pass: Option, } impl Default for LoadBalancerInfo { @@ -23,8 +23,8 @@ impl Default for LoadBalancerInfo { domains: vec![], port: Some(80), tls_enabled: false, - http_auth_user: None, - http_auth_pass: None, + basic_auth_user: None, + basic_auth_pass: None, } } } @@ -93,10 +93,10 @@ impl LoadBalancerImpl for HaproxyLoadBalancer { } } "HTTTP_AUTH_USER" => { - result.http_auth_user = Some(value.to_string()); + result.basic_auth_user = Some(value.to_string()); } "HTTP_AUTH_PASS" => { - result.http_auth_pass = Some(value.to_string()); + result.basic_auth_pass = Some(value.to_string()); } _ => {} }