Skip to content

Commit

Permalink
Construct config only when we need it (istio#1305)
Browse files Browse the repository at this point in the history
Avoid building it for `version` or `help`.

Just a minor cleanup, its not a huge deal.
  • Loading branch information
howardjohn authored Sep 12, 2024
1 parent a3c5ea5 commit 5e4b4c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub static malloc_conf: &[u8] = b"prof:true,prof_active:true,lg_prof_sample:19\0

fn main() -> anyhow::Result<()> {
let _log_flush = telemetry::setup_logging();
let config = Arc::new(config::parse_config()?);

// For now we don't need a complex CLI, so rather than pull in dependencies just use basic argv[1]
match std::env::args().nth(1).as_deref() {
Expand All @@ -48,7 +47,10 @@ fn main() -> anyhow::Result<()> {
.enable_all()
.build()
.unwrap()
.block_on(async move { proxy(config).await })
.block_on(async move {
let config = Arc::new(config::parse_config()?);
proxy(config).await
})
}

fn help() -> anyhow::Result<()> {
Expand Down

0 comments on commit 5e4b4c4

Please sign in to comment.