From f923c702feb7dc2ea7ddafad8c22360d36de663f Mon Sep 17 00:00:00 2001 From: Zhang Jingqiang Date: Wed, 1 Nov 2023 10:21:50 +0800 Subject: [PATCH] f3fcgen: fix inspect of runtime env var --- g3fcgen/src/opts.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/g3fcgen/src/opts.rs b/g3fcgen/src/opts.rs index 42a06a0c1..57fc166e0 100644 --- a/g3fcgen/src/opts.rs +++ b/g3fcgen/src/opts.rs @@ -14,6 +14,7 @@ * limitations under the License. */ +use std::env; use std::net::{IpAddr, Ipv6Addr, SocketAddr}; use std::path::PathBuf; use std::str::FromStr; @@ -112,8 +113,8 @@ pub fn parse_clap() -> anyhow::Result> { } } - if let Some(s) = option_env!("UDP_LISTEN_ADDR") { - if let Ok(addr) = SocketAddr::from_str(s) { + if let Ok(s) = env::var("UDP_LISTEN_ADDR") { + if let Ok(addr) = SocketAddr::from_str(&s) { proc_args.udp_addr = Some(addr); } }