aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server
diff options
context:
space:
mode:
authorXander <xander@biltopia.org>2023-10-22 12:31:51 +0200
committerXander <xander@biltopia.org>2023-10-22 12:31:51 +0200
commit3ac0ecfec25617e5282f507de615c8ea5a29b69d (patch)
tree3c8539c026c5356947896cf751bfe576461f97ef /planetwars-server
parentccee0f7ca6dc2b2542b84922d855f51204033b8a (diff)
downloadplanetwars.dev-3ac0ecfec25617e5282f507de615c8ea5a29b69d.tar.xz
planetwars.dev-3ac0ecfec25617e5282f507de615c8ea5a29b69d.zip
Add containerfile and fix all issues
Diffstat (limited to 'planetwars-server')
-rw-r--r--planetwars-server/src/lib.rs4
-rw-r--r--planetwars-server/src/modules/client_api.rs2
-rw-r--r--planetwars-server/src/modules/matches.rs5
-rw-r--r--planetwars-server/src/routes/matches.rs4
4 files changed, 10 insertions, 5 deletions
diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs
index 39dd57e..127ff05 100644
--- a/planetwars-server/src/lib.rs
+++ b/planetwars-server/src/lib.rs
@@ -167,7 +167,7 @@ pub fn get_config() -> Result<GlobalConfig, ConfigError> {
async fn run_registry(config: Arc<GlobalConfig>, db_pool: DbPool) {
// TODO: put in config
- let addr = SocketAddr::from(([127, 0, 0, 1], 9001));
+ let addr = SocketAddr::from(([0, 0, 0, 0], 9001));
axum::Server::bind(&addr)
.serve(
@@ -193,7 +193,7 @@ pub async fn run_app() {
tokio::spawn(run_client_api(global_config.clone(), db_pool.clone()));
// TODO: put in config
- let addr = SocketAddr::from(([127, 0, 0, 1], 9000));
+ let addr = SocketAddr::from(([0, 0, 0, 0], 9000));
let pw_api_service = create_pw_api(global_config, db_pool).into_make_service();
axum::Server::bind(&addr)
diff --git a/planetwars-server/src/modules/client_api.rs b/planetwars-server/src/modules/client_api.rs
index 9c0bbe7..ac4394f 100644
--- a/planetwars-server/src/modules/client_api.rs
+++ b/planetwars-server/src/modules/client_api.rs
@@ -377,7 +377,7 @@ pub async fn run_client_api(runner_config: Arc<GlobalConfig>, pool: ConnectionPo
runner_config,
};
- let addr = SocketAddr::from(([127, 0, 0, 1], 50051));
+ let addr = SocketAddr::from(([0, 0, 0, 0], 50051));
Server::builder()
.add_service(pb::client_api_service_server::ClientApiServiceServer::new(
server,
diff --git a/planetwars-server/src/modules/matches.rs b/planetwars-server/src/modules/matches.rs
index 489a9fa..f5f9f2a 100644
--- a/planetwars-server/src/modules/matches.rs
+++ b/planetwars-server/src/modules/matches.rs
@@ -141,8 +141,9 @@ pub fn bot_version_to_botspec(
}
fn python_docker_bot_spec(config: &GlobalConfig, code_bundle_path: &str) -> Box<dyn BotSpec> {
- let code_bundle_rel_path = PathBuf::from(&config.bots_directory).join(code_bundle_path);
- let code_bundle_abs_path = std::fs::canonicalize(&code_bundle_rel_path).unwrap();
+ let code_bundle_abs_path = PathBuf::from("/home/planetwars/data/bots").join(code_bundle_path);
+ //let code_bundle_abs_path = std::fs::canonicalize(&code_bundle_rel_path).unwrap();
+ println!("{}",code_bundle_abs_path.display());
let code_bundle_path_str = code_bundle_abs_path.as_os_str().to_str().unwrap();
// TODO: it would be good to simplify this configuration
diff --git a/planetwars-server/src/routes/matches.rs b/planetwars-server/src/routes/matches.rs
index 1ae8c27..0b8e5b7 100644
--- a/planetwars-server/src/routes/matches.rs
+++ b/planetwars-server/src/routes/matches.rs
@@ -108,6 +108,10 @@ pub async fn list_recent_matches(
None => matches::list_public_matches(count, params.before, params.after, &mut conn),
};
+ match matches_result {
+ Ok(_) => println!("ok"),
+ Err(ref err) => println!("{}",err)
+ };
let mut matches = matches_result.expect("failed to get matches"); //.map_err(|_| StatusCode::BAD_REQUEST)?;
let mut has_next = false;