From 21581ab8648b92224d2cfd59f54ac56a72d9c80d Mon Sep 17 00:00:00 2001 From: Tobias Herber <22559657+herber@users.noreply.github.com> Date: Thu, 25 Dec 2025 14:10:14 +0100 Subject: [PATCH] Fix config loader --- Dockerfile | 3 +-- object-store/src/api.rs | 6 ------ object-store/src/config.rs | 10 ++++++++-- object-store/src/main.rs | 2 +- object-store/src/router.rs | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index d777a23..249f9ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,10 +39,9 @@ FROM debian:trixie-slim RUN apt-get update && apt-get install -y \ ca-certificates \ libssl3 \ + curl \ && rm -rf /var/lib/apt/lists/* -RUN apt install -y curl - # Create a non-root user RUN useradd -m -u 1000 appuser diff --git a/object-store/src/api.rs b/object-store/src/api.rs index 226b452..7af3206 100644 --- a/object-store/src/api.rs +++ b/object-store/src/api.rs @@ -93,12 +93,6 @@ pub async fn health_check() -> impl IntoResponse { })) } -pub async fn ping() -> impl IntoResponse { - Json(serde_json::json!({ - "message": "pong" - })) -} - pub async fn create_bucket( State(service): State, Json(payload): Json, diff --git a/object-store/src/config.rs b/object-store/src/config.rs index 196f923..97f23ac 100644 --- a/object-store/src/config.rs +++ b/object-store/src/config.rs @@ -69,7 +69,10 @@ impl Config { pub fn from_file(path: &str) -> Result { let settings = config::Config::builder() .add_source(config::File::with_name(path)) - .add_source(config::Environment::with_prefix("OBJECT_STORE")) + .add_source( + config::Environment::with_prefix("OBJECT_STORE") + .separator("__") + ) .build()?; settings.try_deserialize() @@ -77,7 +80,10 @@ impl Config { pub fn from_env() -> Result { let settings = config::Config::builder() - .add_source(config::Environment::with_prefix("OBJECT_STORE")) + .add_source( + config::Environment::with_prefix("OBJECT_STORE") + .separator("__") + ) .build()?; settings.try_deserialize() diff --git a/object-store/src/main.rs b/object-store/src/main.rs index 39bbad8..76325ac 100644 --- a/object-store/src/main.rs +++ b/object-store/src/main.rs @@ -21,7 +21,7 @@ async fn main() -> anyhow::Result<()> { let config = if let Ok(config_path) = std::env::var("CONFIG_PATH") { Config::from_file(&config_path)? } else { - Config::default() + Config::from_env().unwrap_or_else(|_| Config::default()) }; info!("Starting object storage service with config: {:?}", config); diff --git a/object-store/src/router.rs b/object-store/src/router.rs index fe66f24..049aff8 100644 --- a/object-store/src/router.rs +++ b/object-store/src/router.rs @@ -13,7 +13,7 @@ use crate::service::ObjectStoreService; pub fn create_router(service: Arc) -> Router { Router::new() .route("/health", get(health_check)) - .route("/ping", get(ping)) + .route("/ping", get(health_check)) .route("/buckets", post(create_bucket)) .route("/buckets", put(upsert_bucket)) .route("/buckets", get(list_buckets))