asimov-cli 25.4.0

ASIMOV Command-Line Interface (CLI)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This is free and unencumbered software released into the public domain.

use crate::{BoxError, StandardOptions};
use std::net::IpAddr;

pub async fn url(_flags: &StandardOptions) -> Result<(), BoxError> {
    let host: IpAddr = std::env::var("ASIMOV_PROXY_BIND") // TODO: resolve the host
        .ok()
        .and_then(|input| input.parse::<IpAddr>().ok())
        .unwrap_or(IpAddr::from([127, 0, 0, 1]));
    let port = std::env::var("ASIMOV_PROXY_PORT")
        .ok()
        .and_then(|input| input.parse::<u16>().ok())
        .unwrap_or(1920);
    println!("http://{}:{}/v1", host, port);
    Ok(())
}