allow configuring grpc server url
This commit is contained in:
parent
b0725c21df
commit
fe2f382e04
2 changed files with 11 additions and 2 deletions
|
@ -13,7 +13,7 @@ tonic = "0.7.2"
|
|||
serde = { version = "1.0", features = ["derive"] }
|
||||
toml = "0.5"
|
||||
planetwars-matchrunner = { path = "../planetwars-matchrunner" }
|
||||
clap = { version = "3.2", features = ["derive"]}
|
||||
clap = { version = "3.2", features = ["derive", "env"]}
|
||||
|
||||
[build-dependencies]
|
||||
tonic-build = "0.7.2"
|
||||
|
|
|
@ -18,6 +18,14 @@ struct PlayMatch {
|
|||
|
||||
#[clap(value_parser)]
|
||||
opponent_name: String,
|
||||
|
||||
#[clap(
|
||||
value_parser,
|
||||
long,
|
||||
default_value = "http://planetwars.dev:7492",
|
||||
env = "PLANETWARS_GRPC_SERVER_URL"
|
||||
)]
|
||||
gprc_server_url: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -34,7 +42,8 @@ async fn main() {
|
|||
let content = std::fs::read_to_string(play_match.bot_config_path).unwrap();
|
||||
let bot_config: BotConfig = toml::from_str(&content).unwrap();
|
||||
|
||||
let channel = Channel::from_static("http://localhost:50051")
|
||||
let channel = Channel::from_shared(play_match.gprc_server_url)
|
||||
.expect("invalid grpc server url")
|
||||
.connect()
|
||||
.await
|
||||
.unwrap();
|
||||
|
|
Loading…
Reference in a new issue