Skip to content

Commit

Permalink
bug: trim configuration strings to fix newline messing up port binding
Browse files Browse the repository at this point in the history
  • Loading branch information
bitfl0wer committed Jan 6, 2025
1 parent 9f63d1f commit 737d77d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ pub async fn start_api(
log::info!(target: "symfonia::api", "Starting HTTP Server");

tokio::task::spawn(async move {
// .trim() needs to be called because \n is appended to the .to_string(), messing up the binding
Server::new(TcpListener::bind(
SymfoniaConfiguration::get().api.to_string(),
SymfoniaConfiguration::get().api.to_string().trim(),
))
.run(v9_api)
.await
Expand Down
5 changes: 3 additions & 2 deletions src/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use futures::{
stream::{SplitSink, SplitStream},
SinkExt, StreamExt,
};
use log::info;
use log::{info, trace};
use pubserve::Subscriber;
use serde_json::{from_str, json};
use sqlx::PgPool;
Expand Down Expand Up @@ -104,7 +104,8 @@ pub async fn start_gateway(
info!(target: "symfonia::gateway", "Starting gateway server");

let bind = &SymfoniaConfiguration::get().gateway.to_string();
let try_socket = TcpListener::bind(&bind).await;
// .trim() needs to be called because \n is appended to the .to_string(), messing up the binding
let try_socket = TcpListener::bind(&bind.trim()).await;
let listener = try_socket.expect("Failed to bind to address");

info!(target: "symfonia::gateway", "Gateway server listening on port {bind}");
Expand Down

0 comments on commit 737d77d

Please sign in to comment.