load/create config at startup, add new betas to versions.json

This commit is contained in:
xeon 2024-04-15 16:10:33 +03:00
parent 2fe3285ce7
commit d14681417d
6 changed files with 28 additions and 2 deletions

View file

@ -3,3 +3,7 @@ mod player_info;
pub use global_config::INSTANCE as globals; pub use global_config::INSTANCE as globals;
pub use player_info::PlayerInfo; pub use player_info::PlayerInfo;
pub fn init_config() {
let _globals = &*globals; // this will initialize the static (and create default config)
}

View file

@ -5,11 +5,14 @@ mod logging;
mod net; mod net;
mod util; mod util;
use game::init_config;
use logging::init_tracing; use logging::init_tracing;
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
init_tracing(); init_tracing();
init_config();
net::gateway::listen("0.0.0.0", 23301).await?; net::gateway::listen("0.0.0.0", 23301).await?;
Ok(()) Ok(())

View file

@ -1,3 +1,7 @@
mod version_config; mod version_config;
pub use version_config::INSTANCE as versions; pub use version_config::INSTANCE as versions;
pub fn init_config() {
tracing::info!("loaded {} version configs", versions.len());
}

View file

@ -2,7 +2,6 @@ use anyhow::Result;
use axum::extract::Request; use axum::extract::Request;
use axum::routing::{get, post}; use axum::routing::{get, post};
use axum::{Router, ServiceExt}; use axum::{Router, ServiceExt};
use logging::init_tracing;
use services::{auth, dispatch, errors}; use services::{auth, dispatch, errors};
use tokio::net::TcpListener; use tokio::net::TcpListener;
use tower::Layer; use tower::Layer;
@ -13,11 +12,15 @@ mod config;
mod logging; mod logging;
mod services; mod services;
use config::init_config;
use logging::init_tracing;
const PORT: u16 = 21000; const PORT: u16 = 21000;
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
init_tracing(); init_tracing();
init_config();
let span = tracing::span!(Level::DEBUG, "main"); let span = tracing::span!(Level::DEBUG, "main");
let _ = span.enter(); let _ = span.enter();

View file

@ -14,7 +14,7 @@ pub async fn query_dispatch() -> String {
region_list: vec![RegionInfo { region_list: vec![RegionInfo {
name: String::from("RobinSR"), name: String::from("RobinSR"),
title: String::from("RobinSR"), title: String::from("RobinSR"),
env_type: String::from("9"), env_type: String::from("2"),
dispatch_url: String::from("http://127.0.0.1:21000/query_gateway"), dispatch_url: String::from("http://127.0.0.1:21000/query_gateway"),
..Default::default() ..Default::default()
}], }],

View file

@ -4,5 +4,17 @@
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_6759713_b4e0e740f0da", "ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_6759713_b4e0e740f0da",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_6755976_3c46d7c46e2c", "lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_6755976_3c46d7c46e2c",
"lua_version": "6755976" "lua_version": "6755976"
},
"CNBETAWin2.1.52": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_6785106_15237df2ef89",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_6787319_5f3f1dae4769",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_6785460_26c4b6c61a8b",
"lua_version": "6785460"
},
"CNBETAWin2.1.53": {
"asset_bundle_url": "https://autopatchcn.bhsr.com/asb/BetaLive/output_6828321_72f2df86102b",
"ex_resource_url": "https://autopatchcn.bhsr.com/design_data/BetaLive/output_6834225_44836493b261",
"lua_url": "https://autopatchcn.bhsr.com/lua/BetaLive/output_6828764_f749b48347fd",
"lua_version": "6828764"
} }
} }