//! Runtime configuration: HTTP bind, DB path, server domain, sig-server //! URL. Read from CLI flags and/or environment variables. use std::net::SocketAddr; use std::path::PathBuf; use clap::Parser; #[derive(Debug, Parser, Clone)] #[command(name = "kez-chat-server")] #[command(about = "KEZ chat home server — handle registry + NATS auth + static SPA")] pub struct Config { /// HTTP bind address. #[arg(long, env = "KEZ_CHAT_BIND", default_value = "0.0.0.0:6969")] pub bind: SocketAddr, /// SQLite database file for the handle registry. #[arg(long, env = "KEZ_CHAT_DB", default_value = "kez-chat.db")] pub db: PathBuf, /// This server's domain. Handles registered here belong to /// `@`. Used to validate registrations and /// answer WebFinger queries. #[arg(long, env = "KEZ_CHAT_SERVER", default_value = "kez.lat")] pub server: String, /// Base URL of the sig-server users should publish their sigchains to. /// Returned in handle-lookup responses so clients know where to fetch. #[arg( long, env = "KEZ_CHAT_SIG_SERVER_URL", default_value = "http://localhost:7878" )] pub sig_server_url: String, /// Optional directory of static files to serve at `/` (the SPA build /// output). If unset, `/` serves a built-in placeholder page. #[arg(long, env = "KEZ_CHAT_WEB_DIR")] pub web_dir: Option, }