Skip to content

Commit

Permalink
fix: allow mgmt api to use tls
Browse files Browse the repository at this point in the history
  • Loading branch information
hjr3 committed Feb 12, 2024
1 parent 70d1442 commit 4ea6ec5
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions crates/proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ async fn main() -> Result<()> {
let mgmt_listener = config.management.listen.parse()?;
let ingest_listener = config.proxy.listen.parse()?;

tokio::spawn(async move {
tracing::info!("management API listening on {}", mgmt_listener);
if let Err(err) = axum_server::bind(mgmt_listener)
.serve(mgmt.into_make_service())
.await
{
eprintln!("Failed to start management API server: {}", err);
}
});

tokio::spawn(async move {
tracing::info!("starting retry queue");
retry_queue.start().await;
Expand All @@ -54,6 +44,25 @@ async fn main() -> Result<()> {
None
};

let mgmt_tls_config = tls_config.clone();
tokio::spawn(async move {
tracing::info!("management API listening on {}", mgmt_listener);
if let Some(tls_config) = mgmt_tls_config {
tracing::info!("tls configured for {}", mgmt_listener);
if let Err(err) = axum_server::bind_rustls(mgmt_listener, tls_config)
.serve(mgmt.into_make_service())
.await
{
eprintln!("Failed to start management API server: {}", err);
}
} else if let Err(err) = axum_server::bind(mgmt_listener)
.serve(mgmt.into_make_service())
.await
{
eprintln!("Failed to start management API server: {}", err);
}
});

tracing::info!("ingest listening on {}", ingest_listener);
if let Some(tls_config) = tls_config {
tracing::info!("tls configured for {}", ingest_listener);
Expand Down

0 comments on commit 4ea6ec5

Please sign in to comment.