From 536a5eb9445794352eb2384fb24a9c6ab4144ec2 Mon Sep 17 00:00:00 2001 From: christoff-linde Date: Sun, 10 Mar 2024 11:44:45 +0200 Subject: [PATCH 1/4] fix(http): use UNSPECIFIED addr in host to enable hosting on 0.0.0.0 --- src/http/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/mod.rs b/src/http/mod.rs index e45dc5d..ff64b7a 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -49,7 +49,7 @@ pub async fn serve(config: Config, db_pool: PgPool) -> anyhow::Result<()> { let app = api_router(api_context); - let addr = SocketAddr::from((Ipv4Addr::LOCALHOST, 3000)); + let addr = SocketAddr::from((Ipv4Addr::UNSPECIFIED, 3000)); let listener = TcpListener::bind(addr).await?; axum::serve(listener, app) .with_graceful_shutdown(shutdown_signal()) From f72939429e0e5797d3d781218f3857bc0233a355 Mon Sep 17 00:00:00 2001 From: christoff-linde Date: Sun, 10 Mar 2024 12:51:43 +0200 Subject: [PATCH 2/4] chore(sensors): update println to use tracing --- src/http/sensors/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http/sensors/mod.rs b/src/http/sensors/mod.rs index bd398a4..5670f34 100644 --- a/src/http/sensors/mod.rs +++ b/src/http/sensors/mod.rs @@ -51,10 +51,10 @@ async fn create_sensor_reading( match result { Ok(_) => { - println!("ROW inserted"); + tracing::debug!("Successfully inserted row: {:?}", &result); } Err(error) => { - println!("ERROR inserting row: {}", error); + tracing::error!("Error inserting row: {:?}", error); } } From 5ecc5d0975ab0a18c3b6805bb73b07a835f16b28 Mon Sep 17 00:00:00 2001 From: christoff-linde Date: Sun, 10 Mar 2024 12:52:06 +0200 Subject: [PATCH 3/4] feat(docker-compose): add .env.override support in docker-compose --- docker-compose.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 580ee96..09da987 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,8 @@ version: "3" +networks: + default: + name: pih-rs services: backend: container_name: pih-rs-api @@ -9,8 +12,7 @@ services: dockerfile: Dockerfile env_file: - ./.env - environment: - RUST_BACKTRACE: 1 + - ./.env.override ports: - "3000:3000" depends_on: From d8acaf0cf50d7c2e63e25a2e7f84939af3dcc511 Mon Sep 17 00:00:00 2001 From: christoff-linde Date: Sun, 10 Mar 2024 12:52:44 +0200 Subject: [PATCH 4/4] chore(gitignore): add .env.override --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fedaa2b..d55469a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target .env +.env.override