[Fix] purpose build port
This commit is contained in:
parent
b790c66877
commit
dbcd6630ce
1 changed files with 0 additions and 19 deletions
|
|
@ -96,25 +96,6 @@ async fn main() {
|
|||
let cert_path = certs_dir.join("cert.pem");
|
||||
let key_path = certs_dir.join("key.pem");
|
||||
|
||||
if cert_path.exists() && key_path.exists() {
|
||||
let tls_config = RustlsConfig::from_pem_file(cert_path, key_path)
|
||||
.await
|
||||
.expect("Failed to load TLS certificates");
|
||||
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], 443));
|
||||
info!("HTTPS server listening on {}", addr);
|
||||
|
||||
axum_server::bind_rustls(addr, tls_config)
|
||||
.serve(app.into_make_service())
|
||||
.await
|
||||
.unwrap();
|
||||
} else {
|
||||
warn!("TLS certificates not found, running HTTP only on port 8080");
|
||||
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
|
||||
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
|
||||
axum::serve(listener, app).await.unwrap();
|
||||
}
|
||||
|
||||
http_handle.await.unwrap();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue