mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-04 09:34:08 +02:00
show proxy addr for ldap-admin in startup message
This commit is contained in:
parent
e76678ec14
commit
88a4100340
4 changed files with 26 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use crate::cloud::CloudOptions;
|
||||
use crate::config::HazeConfig;
|
||||
use crate::config::{HazeConfig, ProxyConfig};
|
||||
use crate::image::pull_image;
|
||||
use crate::service::ServiceTrait;
|
||||
use crate::Result;
|
||||
|
|
@ -9,6 +9,8 @@ use bollard::query_parameters::CreateContainerOptions;
|
|||
use bollard::Docker;
|
||||
use maplit::hashmap;
|
||||
use miette::{IntoDiagnostic, Report};
|
||||
use std::net::IpAddr;
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Ldap;
|
||||
|
|
@ -151,9 +153,15 @@ impl ServiceTrait for LdapAdmin {
|
|||
Some(format!("{}-ldap-admin", cloud_id))
|
||||
}
|
||||
|
||||
async fn start_message(&self, docker: &Docker, cloud_id: &str) -> Result<Option<String>> {
|
||||
async fn start_message(
|
||||
&self,
|
||||
docker: &Docker,
|
||||
cloud_id: &str,
|
||||
proxy: &ProxyConfig,
|
||||
) -> Result<Option<String>> {
|
||||
let id = self.container_name(cloud_id).unwrap();
|
||||
let info = docker
|
||||
.inspect_container(&self.container_name(cloud_id).unwrap(), None)
|
||||
.inspect_container(&id, None)
|
||||
.await
|
||||
.into_diagnostic()?;
|
||||
let ip = if matches!(
|
||||
|
|
@ -176,9 +184,9 @@ impl ServiceTrait for LdapAdmin {
|
|||
} else {
|
||||
return Err(Report::msg("ldap admin not started"));
|
||||
};
|
||||
let addr = proxy.addr(&id, IpAddr::from_str(&ip).unwrap());
|
||||
Ok(Some(format!(
|
||||
"Ldap admin running at: https://{} with 'cn=admin,dc=example,dc=org' and password 'haze'",
|
||||
ip
|
||||
"Ldap admin running at: {addr} with 'cn=admin,dc=example,dc=org' and password 'haze'"
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue