Compare commits

...

2 commits

Author SHA1 Message Date
7333ced376
feat(controller): use env in clap to allow env var config
Some checks failed
ci/woodpecker/push/ci Pipeline failed
2025-01-08 16:41:58 +01:00
a9a4c513f5
feat(controller): add listen-address flag 2025-01-08 16:40:07 +01:00
2 changed files with 11 additions and 3 deletions

View file

@ -27,6 +27,7 @@ anyhow = "1.0.95"
clap = { version = "4.5.23", features = [
"derive",
"deprecated",
"env",
"wrap_help",
"string",
] }

View file

@ -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<String>,
@ -26,9 +26,16 @@ 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",
env = "LISTEN_ADDRESS"
)]
listen_address: String,
}
#[tokio::main]
@ -39,7 +46,7 @@ async fn main() -> Result<()> {
tracing::info!("Patagia Controller");
let config = ConfigDropshot {
bind_address: SocketAddr::from_str("0.0.0.0:9474").unwrap(),
bind_address: SocketAddr::from_str(&args.listen_address).unwrap(),
..Default::default()
};