enable ssl for grpc client
This commit is contained in:
parent
fe2f382e04
commit
1cf20810c5
2 changed files with 9 additions and 8 deletions
|
@ -9,7 +9,7 @@ edition = "2021"
|
||||||
tokio = { version = "1.15", features = ["full"] }
|
tokio = { version = "1.15", features = ["full"] }
|
||||||
tokio-stream = "0.1.9"
|
tokio-stream = "0.1.9"
|
||||||
prost = "0.10"
|
prost = "0.10"
|
||||||
tonic = "0.7.2"
|
tonic = { version = "0.7.2", features = ["tls", "tls-roots"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
toml = "0.5"
|
toml = "0.5"
|
||||||
planetwars-matchrunner = { path = "../planetwars-matchrunner" }
|
planetwars-matchrunner = { path = "../planetwars-matchrunner" }
|
||||||
|
|
|
@ -22,10 +22,10 @@ struct PlayMatch {
|
||||||
#[clap(
|
#[clap(
|
||||||
value_parser,
|
value_parser,
|
||||||
long,
|
long,
|
||||||
default_value = "http://planetwars.dev:7492",
|
default_value = "https://planetwars.dev:7492",
|
||||||
env = "PLANETWARS_GRPC_SERVER_URL"
|
env = "PLANETWARS_GRPC_SERVER_URL"
|
||||||
)]
|
)]
|
||||||
gprc_server_url: String,
|
grpc_server_url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -42,11 +42,12 @@ async fn main() {
|
||||||
let content = std::fs::read_to_string(play_match.bot_config_path).unwrap();
|
let content = std::fs::read_to_string(play_match.bot_config_path).unwrap();
|
||||||
let bot_config: BotConfig = toml::from_str(&content).unwrap();
|
let bot_config: BotConfig = toml::from_str(&content).unwrap();
|
||||||
|
|
||||||
let channel = Channel::from_shared(play_match.gprc_server_url)
|
let uri = play_match
|
||||||
.expect("invalid grpc server url")
|
.grpc_server_url
|
||||||
.connect()
|
.parse()
|
||||||
.await
|
.expect("invalid grpc url");
|
||||||
.unwrap();
|
|
||||||
|
let channel = Channel::builder(uri).connect().await.unwrap();
|
||||||
|
|
||||||
let created_match = create_match(channel.clone(), play_match.opponent_name)
|
let created_match = create_match(channel.clone(), play_match.opponent_name)
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Reference in a new issue