Use env vars for TLS files

This commit is contained in:
Alphonse Paix
2025-09-05 18:27:46 +02:00
parent 8d6cab41d0
commit 54b0512f3f
3 changed files with 8 additions and 6 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