add environment variable for server
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Johannes Heuel
2022-12-20 18:15:56 +01:00
parent 126145ede7
commit 461cdb2cc7
4 changed files with 19 additions and 10 deletions

View File

@@ -136,7 +136,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
.arg(
Arg::with_name("server")
.takes_value(true)
.required(true)
.help("Set Zoidberg server address"),
)
.arg(
@@ -145,7 +144,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
.value_parser(value_parser!(i32)),
)
.get_matches();
let server = matches.value_of("server").unwrap();
let threads: i32 = if let Some(t) = matches.get_one::<i32>("threads") {
*t
} else {
@@ -157,8 +155,12 @@ async fn main() -> Result<(), Box<dyn Error>> {
std::process::exit(1);
});
let server = std::env::var("ZOIDBERG_SERVER").unwrap_or_else(|_| {
String::from(matches.value_of("server").unwrap())
});
let client = Arc::new(
Worker::new(server, &secret, threads)
Worker::new(&server, &secret, threads)
.await
.expect("Could not create client"),
);