Skip to content

Commit

Permalink
f3fcgen: fix inspect of runtime env var
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq-b committed Nov 1, 2023
1 parent 189378b commit f923c70
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions g3fcgen/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -112,8 +113,8 @@ pub fn parse_clap() -> anyhow::Result<Option<ProcArgs>> {
}
}

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);
}
}
Expand Down

0 comments on commit f923c70

Please sign in to comment.