#[cfg(feature = "tls")]
use std::path::PathBuf;
#[cfg(feature = "tls")]
#[derive(Clone, Debug)]
pub struct TlsConfig {
pub cert_path: PathBuf,
pub key_path: PathBuf,
}
#[cfg(feature = "tls")]
impl TlsConfig {
pub fn new(cert_path: impl Into<PathBuf>, key_path: impl Into<PathBuf>) -> Self {
Self {
cert_path: cert_path.into(),
key_path: key_path.into(),
}
}
pub async fn build_rustls_config(
&self,
) -> Result<axum_server::tls_rustls::RustlsConfig, std::io::Error> {
axum_server::tls_rustls::RustlsConfig::from_pem_file(&self.cert_path, &self.key_path).await
}
}