basiliq 0.1.2

REST API server exposing a Postgres database using JSON:API
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::*;

/// Extract the first bindable ip from the host parameter provided by the CLI or by default
pub async fn get_bind_address(
    dns_resolver: &trust_dns_resolver::TokioAsyncResolver,
    server_cfg: &BasiliqCliServerConfig,
) -> Result<std::net::IpAddr, BasiliqError> {
    dns_resolver
        .lookup_ip(server_cfg.bind_address().as_str())
        .await?
        .iter()
        .next()
        .ok_or(BasiliqError::NoBindableIp)
}