/** * Config Vault - cfgvault * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Paolo Lulli * @copyright Paolo Lulli 2026 */ mod config; mod handlers; mod server; mod tls; mod vault; use clap::Parser; use std::net::TcpListener; #[tokio::main] async fn main() -> std::io::Result<()> { let args = config::Cli::parse(); let filename = if args.config_file.is_empty() { env!("HOME").to_string() + "/.config/cfgvault.json" } else { args.config_file }; println!("Use config file: {}", filename); let config = config::read_config(filename); vault::unlock(&config); let listener = TcpListener::bind(&config.endpoint).expect("Failed to bind port"); let port = listener.local_addr()?.port(); println!("Listen on port {}", port); server::run(config, listener)?.await }