From 7333ced376f7d1e5c4b79bf9504cb25034fd2399 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Wed, 8 Jan 2025 16:41:32 +0100 Subject: [PATCH] feat(controller): use env in clap to allow env var config --- Cargo.toml | 1 + controller/src/bin/patagia-controller.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3acc508..e5c1d3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ anyhow = "1.0.95" clap = { version = "4.5.23", features = [ "derive", "deprecated", + "env", "wrap_help", "string", ] } diff --git a/controller/src/bin/patagia-controller.rs b/controller/src/bin/patagia-controller.rs index b8734f9..bc0b9b0 100644 --- a/controller/src/bin/patagia-controller.rs +++ b/controller/src/bin/patagia-controller.rs @@ -18,7 +18,7 @@ struct Cli { #[arg( long = "telemetry-otlp-endpoint", default_value = "http://localhost:4317", - value_name = "OTEL_EXPORTER_OTLP_ENDPOINT" + env = "OTEL_EXPORTER_OTLP_ENDPOINT", )] otlp_endpoint: Option, @@ -26,14 +26,14 @@ struct Cli { long = "log-stderr", short = 'v', default_value = "false", - value_name = "LOG_TO_STDERR" + env = "LOG_TO_STDERR" )] log_stderr: bool, #[arg( long = "listen-address", default_value = "0.0.0.0:9474", - value_name = "LISTEN_ADDRESS" + env = "LISTEN_ADDRESS" )] listen_address: String, }