Skip to content

Commit 5058e05

Browse files
update url fetch
1 parent 4e7705d commit 5058e05

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/cli.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,17 @@ impl Options {
492492
}
493493
(&self.querier_endpoint, "P_QUERIER_ENDPOINT")
494494
}
495-
_ => panic!("Invalid mode"),
495+
_ => {
496+
return format!(
497+
"{}://{}",
498+
self.get_scheme(),
499+
self.address
500+
)
501+
.parse::<Url>() // if the value was improperly set, this will panic before hand
502+
.unwrap_or_else(|err| {
503+
panic!("{err}, failed to parse `{}` as Url. Please set the environment variable `P_ADDR` to `<ip address>:<port>` without the scheme (e.g., 192.168.1.1:8000). Please refer to the documentation: https://logg.ing/env for more details.", self.address)
504+
});
505+
}
496506
};
497507

498508
if endpoint.starts_with("http") {

0 commit comments

Comments
 (0)