feat: extra debug logging and chore: fix unused

This commit is contained in:
hexlocation 2025-07-29 12:53:21 +02:00
parent a6b2127b0c
commit e2d9789f9a
6 changed files with 80 additions and 47 deletions

View file

@ -45,45 +45,16 @@ impl Client {
.nth(0)
.unwrap();
return bcrypt::verify(secret, client.hashed_secret.as_str()).unwrap();
bcrypt::verify(secret, client.hashed_secret.as_str()).unwrap()
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
pub struct Host {
pub hostname: String,
pub address: String,
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
pub struct Config {
pub db: Db,
pub database: String,
pub proxy: Proxy,
pub api: Api,
pub clients: Vec<Client>,
pub hosts: Vec<Host>,
}
impl Db {
pub async fn to_string(&self) -> String {
let mut builder = String::new();
builder += format!(
"host={} port={} user={} dbname={}",
self.host,
self.port.unwrap_or(5432),
self.user,
self.database.clone().unwrap_or(self.user.clone()),
)
.as_str();
match &self.password {
Some(x) => builder += format!(" password={}", x).as_str(),
None => {}
}
builder
}
}
impl Config {