diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-08-08 18:04:21 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-08-08 18:04:21 +0200 |
commit | 48a421a3b6c07705b67276853643ed5601a30154 (patch) | |
tree | 3c100be1df8365316c49d5b44dd649c6af92f5e1 /src/main.rs | |
parent | 3999723308da10e564c4634997c6ecf63f2839d4 (diff) | |
download | tricot-feat/load-certs-at-boot.tar.gz tricot-feat/load-certs-at-boot.zip |
feat: warmup memory store when startingdocker-49feat/load-certs-at-boot
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index c148a91..43f3447 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,6 +101,12 @@ struct Opt { default_value = "text/html,text/plain,text/css,text/javascript,text/xml,application/javascript,application/json,application/xml,image/svg+xml,font/ttf" )] pub compress_mime_types: String, + + #[structopt( + long = "warmup-cert-memory-store", + env = "TRICOT_WARMUP_CERT_MEMORY_STORE" + )] + pub warmup_cert_memory_store: bool, } #[tokio::main(flavor = "multi_thread", worker_threads = 10)] @@ -154,6 +160,12 @@ async fn main() { opt.letsencrypt_email.clone(), exit_on_err.clone(), ); + if opt.warmup_cert_memory_store { + match cert_store.warmup_memory_store().await { + Err(e) => error!("An error occured while warming up the certificate memory store with Consul data, continue without caching: {e}"), + _ => (), + }; + } let metrics_task = tokio::spawn( metrics_server |