show match url in planetwars_client
This commit is contained in:
parent
b84e9be9d6
commit
1011015b29
5 changed files with 16 additions and 0 deletions
|
@ -29,6 +29,10 @@ async fn main() {
|
|||
|
||||
let created_match = create_match(channel.clone()).await.unwrap();
|
||||
run_player(bot_config, created_match.player_key, channel).await;
|
||||
println!(
|
||||
"Match completed. Watch the replay at {}",
|
||||
created_match.match_url
|
||||
);
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
database_url = "postgresql://planetwars:planetwars@localhost/planetwars"
|
||||
|
||||
# front-end is served here in development, which proxies to the backend
|
||||
root_url = "http://localhost:3000"
|
||||
|
||||
python_runner_image = "python:3.10-slim-buster"
|
||||
container_registry_url = "localhost:9001"
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ pub struct GlobalConfig {
|
|||
/// this will be used when running bots
|
||||
pub container_registry_url: String,
|
||||
|
||||
/// webserver root url, used to construct links
|
||||
pub root_url: String,
|
||||
|
||||
/// directory where bot code will be stored
|
||||
pub bots_directory: String,
|
||||
/// directory where match logs will be stored
|
||||
|
|
|
@ -135,6 +135,11 @@ impl pb::bot_api_service_server::BotApiService for BotApiServer {
|
|||
Ok(Response::new(pb::CreatedMatch {
|
||||
match_id: created_match.base.id,
|
||||
player_key,
|
||||
// TODO: can we avoid hardcoding this?
|
||||
match_url: format!(
|
||||
"{}/matches/{}",
|
||||
self.runner_config.root_url, created_match.base.id
|
||||
),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ message MatchRequest {
|
|||
message CreatedMatch {
|
||||
int32 match_id = 1;
|
||||
string player_key = 2;
|
||||
string match_url = 3;
|
||||
}
|
||||
|
||||
service BotApiService {
|
||||
|
|
Loading…
Reference in a new issue