diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-22 23:50:52 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-22 23:50:52 +0200 |
commit | 1cf20810c5191c426f9226a13f4a0d0e09c8f74b (patch) | |
tree | 48a3e755c208bd8074753091a6dcda8b9efafa1e | |
parent | fe2f382e0478b13e57a8e79a4c4c5a919f0d1a33 (diff) | |
download | planetwars.dev-1cf20810c5191c426f9226a13f4a0d0e09c8f74b.tar.xz planetwars.dev-1cf20810c5191c426f9226a13f4a0d0e09c8f74b.zip |
enable ssl for grpc client
-rw-r--r-- | planetwars-client/Cargo.toml | 2 | ||||
-rw-r--r-- | planetwars-client/src/main.rs | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/planetwars-client/Cargo.toml b/planetwars-client/Cargo.toml index 69a72a6..4ff96f2 100644 --- a/planetwars-client/Cargo.toml +++ b/planetwars-client/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" tokio = { version = "1.15", features = ["full"] } tokio-stream = "0.1.9" prost = "0.10" -tonic = "0.7.2" +tonic = { version = "0.7.2", features = ["tls", "tls-roots"] } serde = { version = "1.0", features = ["derive"] } toml = "0.5" planetwars-matchrunner = { path = "../planetwars-matchrunner" } diff --git a/planetwars-client/src/main.rs b/planetwars-client/src/main.rs index ae2fb5e..c9d97b0 100644 --- a/planetwars-client/src/main.rs +++ b/planetwars-client/src/main.rs @@ -22,10 +22,10 @@ struct PlayMatch { #[clap( value_parser, long, - default_value = "http://planetwars.dev:7492", + default_value = "https://planetwars.dev:7492", env = "PLANETWARS_GRPC_SERVER_URL" )] - gprc_server_url: String, + grpc_server_url: String, } #[derive(Deserialize)] @@ -42,11 +42,12 @@ 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_shared(play_match.gprc_server_url) - .expect("invalid grpc server url") - .connect() - .await - .unwrap(); + let uri = play_match + .grpc_server_url + .parse() + .expect("invalid grpc url"); + + let channel = Channel::builder(uri).connect().await.unwrap(); let created_match = create_match(channel.clone(), play_match.opponent_name) .await |