Automatically regenerate CRLs at regular interval
This commit is contained in:
@ -5,6 +5,7 @@ use central_backend::energy::energy_actor::EnergyActor;
|
||||
use central_backend::server::servers;
|
||||
use central_backend::utils::files_utils::create_directory_if_missing;
|
||||
use futures::future;
|
||||
use tokio_schedule::{every, Job};
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
@ -23,9 +24,15 @@ async fn main() -> std::io::Result<()> {
|
||||
pki::initialize_devices_ca().expect("Failed to initialize devices CA!");
|
||||
pki::initialize_server_ca().expect("Failed to initialize server certificate!");
|
||||
|
||||
// Initialize CRL
|
||||
pki::refresh_crls().expect("Failed to initialize Root CA!");
|
||||
|
||||
// TODO : schedule CRL auto renewal
|
||||
let refresh_crl = every(1).hour().perform(|| async {
|
||||
log::info!("Periodic refresh of CRLs...");
|
||||
if let Err(e) = pki::refresh_crls() {
|
||||
log::error!("Failed to perform auto refresh of CRLs! {e}");
|
||||
}
|
||||
});
|
||||
tokio::spawn(refresh_crl);
|
||||
|
||||
// Initialize energy actor
|
||||
let actor = EnergyActor::new()
|
||||
|
Reference in New Issue
Block a user