use std::env;
use tracing::{info, warn};
fn init_rustls_crypto_provider() {
let _ = rustls::crypto::ring::default_provider().install_default();
}
#[tokio::main(worker_threads = 2)]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let dotenv_outcome = dotenvy::dotenv().map_err(|e| e.to_string());
let log_level = env::var("RUST_LOG").unwrap_or_else(|_| "info".to_string());
let level = match log_level.to_lowercase().as_str() {
"debug" => tracing::Level::DEBUG,
"warn" => tracing::Level::WARN,
"error" => tracing::Level::ERROR,
"trace" => tracing::Level::TRACE,
_ => tracing::Level::INFO,
};
tracing_subscriber::fmt()
.with_writer(std::io::sink)
.with_max_level(level)
.init();
match dotenv_outcome {
Ok(path) => info!(?path, "loaded .env"),
Err(e) => warn!(error = %e, "failed to load .env"),
}
init_rustls_crypto_provider();
cinder::run().await
}