2023-12-04 17:21:55 +00:00
|
|
|
use log::info;
|
2023-10-01 15:16:23 +00:00
|
|
|
use once_cell::sync::Lazy;
|
2024-05-09 11:33:23 +00:00
|
|
|
use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer};
|
2023-10-01 15:16:23 +00:00
|
|
|
|
2024-05-09 11:33:23 +00:00
|
|
|
pub static TLS_PRIVATE_KEY: Lazy<PrivateKeyDer<'static>> = Lazy::new(|| {
|
2023-12-04 17:21:55 +00:00
|
|
|
info!("Loading embedded tls private key");
|
|
|
|
|
2023-10-01 15:16:23 +00:00
|
|
|
let key = include_bytes!("../certs/key.pem");
|
2023-12-04 17:21:55 +00:00
|
|
|
let key = rustls_pemfile::private_key(&mut key.as_slice())
|
|
|
|
.expect("failed to load embedded tls private key")
|
|
|
|
.expect("failed to load embedded tls private key");
|
2024-05-09 11:33:23 +00:00
|
|
|
key
|
2023-10-01 15:16:23 +00:00
|
|
|
});
|
2024-05-09 11:33:23 +00:00
|
|
|
pub static TLS_CERTIFICATE: Lazy<Vec<CertificateDer<'static>>> = Lazy::new(|| {
|
2023-12-04 17:21:55 +00:00
|
|
|
info!("Loading embedded tls certificate");
|
|
|
|
|
2023-10-01 15:16:23 +00:00
|
|
|
let cert = include_bytes!("../certs/cert.pem");
|
2023-12-04 17:21:55 +00:00
|
|
|
let certs = rustls_pemfile::certs(&mut cert.as_slice())
|
|
|
|
.next()
|
|
|
|
.expect("failed to load embedded tls certificate");
|
2023-10-01 15:16:23 +00:00
|
|
|
|
2024-05-09 11:33:23 +00:00
|
|
|
certs.into_iter().collect()
|
2023-10-01 15:16:23 +00:00
|
|
|
});
|