1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Update configs for release ready

This commit is contained in:
NGnius (Graham)
2025-04-02 20:59:52 -04:00
parent 69d1bfaee0
commit d5f9a4562d
22 changed files with 156 additions and 38 deletions

18
rc_static_data/src/cli.rs Normal file
View File

@@ -0,0 +1,18 @@
use clap::Parser;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct CliArgs {
/// URL of authentication web server
#[arg(long, default_value_t = {"http://127.0.0.1:8001/".to_string()})]
pub auth: String,
/// URL of microtransactions web server
#[arg(long, default_value_t = {"http://127.0.0.1:8011/".to_string()})]
pub pay: String,
}
impl CliArgs {
pub fn get() -> Self {
Self::parse()
}
}

View File

@@ -1,14 +1,22 @@
mod robocraft;
mod cli;
#[rocket::get("/")]
fn index() -> &'static str {
"Hello, world!"
fn index() -> String {
let name = env!("CARGO_PKG_NAME");
let version = env!("CARGO_PKG_VERSION");
let authors = env!("CARGO_PKG_AUTHORS");
let license = env!("CARGO_PKG_LICENSE");
let repo = env!("CARGO_PKG_REPOSITORY");
format!("{} {} by [{}]\n{}\n{}", name, version, authors, license, repo)
}
#[rocket::launch]
fn rocket() -> _ {
env_logger::init();
let args = cli::CliArgs::get();
rocket::build().mount("/", rocket::routes![index])
.attach(robocraft::stage())
.manage(args)
}

View File

@@ -1,7 +1,7 @@
use rocket::{get, routes, serde::json::Json};
use rocket::{get, routes, serde::json::Json, State};
#[get("/live/data.json")]
pub fn static_live_data() -> Json<libfj::robocraft::StaticDataRaw> {
pub fn static_live_data(cli: &State<crate::cli::CliArgs>) -> Json<libfj::robocraft::StaticDataRaw> {
Json(libfj::robocraft::StaticDataRaw {
MaintenanceMode: "false".into(),
MaintenanceRegex: "".into(),
@@ -15,8 +15,8 @@ pub fn static_live_data() -> Json<libfj::robocraft::StaticDataRaw> {
PhotonLobbyServer: "rc-backend.servers.robocraftgame.com:4540".into(),
ErrorLogAddress: "logs.freejamgames.com:4561".into(),
ServerErrorLogAddress: "logs.freejamgames.com:4562".into(),
authUrl: "http://127.0.0.1:8001/".into(), // originally "https://auth-backend.freejamgames.com/"
paymentUrl: "http://127.0.0.1:8011/".into(),
authUrl: cli.auth.clone(), // originally "https://auth-backend.freejamgames.com/"
paymentUrl: cli.pay.clone(),
enterBattleLogGenerationTimeout: "60".into(),
GameServerConnectionTestTimeout: 10,
AvatarCdnUrl: "https://rc-cdn-images.robocraftgame.com/customavatar/Live/".into(),