Use env vars for TLS files

This commit is contained in:
Alphonse Paix
2025-09-05 18:27:46 +02:00
parent a7d22e6634
commit c727b5032c
2 changed files with 7 additions and 5 deletions

View File

@@ -62,14 +62,16 @@ impl Application {
configuration.application.base_url,
redis_store,
);
let tls_config = if configuration.application.require_tls {
let tls_config = if configuration.require_tls {
Some(
RustlsConfig::from_pem_file(
"/home/alphonse/.certs/fullchain.pem",
"/home/alphonse/.certs/privkey.pem",
std::env::var("APP_TLS_CERT")
.expect("Failed to read TLS certificate environment variable"),
std::env::var("APP_TLS_KEY")
.expect("Feiled to read TLS private key environment variable"),
)
.await
.unwrap(),
.expect("Could not create TLS configuration"),
)
} else {
None