SDKServer: query_gateway cdn links configuration
This commit is contained in:
parent
bfe0374bfe
commit
bccf928bbe
5 changed files with 42 additions and 17 deletions
10
Cargo.toml
10
Cargo.toml
|
@ -14,17 +14,13 @@ lazy_static = "1.4.0"
|
||||||
axum = "0.7.4"
|
axum = "0.7.4"
|
||||||
axum-server = "0.6.0"
|
axum-server = "0.6.0"
|
||||||
|
|
||||||
|
dirs = "5.0.1"
|
||||||
|
dotenv = "0.15.0"
|
||||||
|
|
||||||
env_logger = "0.11.3"
|
env_logger = "0.11.3"
|
||||||
|
|
||||||
rbase64 = "2.0.3"
|
rbase64 = "2.0.3"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
rsa = { version = "0.9.6", features = [
|
|
||||||
"sha1",
|
|
||||||
"nightly",
|
|
||||||
"pkcs5",
|
|
||||||
"serde",
|
|
||||||
"sha2",
|
|
||||||
] }
|
|
||||||
|
|
||||||
prost = "0.12.3"
|
prost = "0.12.3"
|
||||||
prost-types = "0.12.3"
|
prost-types = "0.12.3"
|
||||||
|
|
4
sdkserver/.env
Normal file
4
sdkserver/.env
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
ASSET_BUNDLE_URL=https://autopatchcn.bhsr.com/asb/BetaLive/output_6744505_89b2f5dc973e
|
||||||
|
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_VERSION=6755976
|
|
@ -10,6 +10,9 @@ env_logger.workspace = true
|
||||||
axum.workspace = true
|
axum.workspace = true
|
||||||
axum-server.workspace = true
|
axum-server.workspace = true
|
||||||
|
|
||||||
|
dirs.workspace = true
|
||||||
|
dotenv.workspace = true
|
||||||
|
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|
||||||
|
|
|
@ -3,16 +3,19 @@ use axum::routing::{get, post};
|
||||||
use axum::Router;
|
use axum::Router;
|
||||||
use logging::init_tracing;
|
use logging::init_tracing;
|
||||||
use services::{auth, dispatch, errors};
|
use services::{auth, dispatch, errors};
|
||||||
|
use std::path::Path;
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
|
|
||||||
mod logging;
|
mod logging;
|
||||||
mod services;
|
mod services;
|
||||||
|
|
||||||
const PORT: u16 = 21000;
|
const PORT: u16 = 21000;
|
||||||
|
const DEFAULT_DOTENV: &str = include_str!("../.env");
|
||||||
|
|
||||||
#[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();
|
||||||
|
@ -49,3 +52,26 @@ async fn main() -> Result<()> {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn init_config() -> Result<()> {
|
||||||
|
let local_dotenv = Path::new(".env");
|
||||||
|
if local_dotenv.exists() {
|
||||||
|
dotenv::dotenv()?;
|
||||||
|
} else {
|
||||||
|
let config = dirs::config_dir()
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("No config directory found"))?
|
||||||
|
.join("hkrpg-sdkserver");
|
||||||
|
|
||||||
|
std::fs::create_dir_all(&config)?;
|
||||||
|
|
||||||
|
let env = config.join(".env");
|
||||||
|
|
||||||
|
if !env.exists() {
|
||||||
|
std::fs::write(&env, DEFAULT_DOTENV)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
dotenv::from_path(&env)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::env;
|
||||||
|
|
||||||
use prost::Message;
|
use prost::Message;
|
||||||
use proto::{Dispatch, Gateserver, RegionInfo};
|
use proto::{Dispatch, Gateserver, RegionInfo};
|
||||||
|
|
||||||
|
@ -30,17 +32,11 @@ pub async fn query_gateway() -> String {
|
||||||
retcode: 0,
|
retcode: 0,
|
||||||
ip: String::from("127.0.0.1"),
|
ip: String::from("127.0.0.1"),
|
||||||
port: 23301,
|
port: 23301,
|
||||||
asset_bundle_url: String::from(
|
asset_bundle_url: env::var("ASSET_BUNDLE_URL").unwrap(),
|
||||||
"https://autopatchcn.bhsr.com/asb/BetaLive/output_6744505_89b2f5dc973e",
|
ex_resource_url: env::var("EX_RESOURCE_URL").unwrap(),
|
||||||
),
|
lua_url: env::var("LUA_URL").unwrap(),
|
||||||
lua_url: String::from(
|
lua_version: env::var("LUA_VERSION").unwrap(),
|
||||||
"https://autopatchcn.bhsr.com/lua/BetaLive/output_6755976_3c46d7c46e2c",
|
|
||||||
),
|
|
||||||
ex_resource_url: String::from(
|
|
||||||
"https://autopatchcn.bhsr.com/design_data/BetaLive/output_6759713_b4e0e740f0da",
|
|
||||||
),
|
|
||||||
ifix_version: String::from("0"),
|
ifix_version: String::from("0"),
|
||||||
lua_version: String::from("6755976"),
|
|
||||||
jblkncaoiao: true,
|
jblkncaoiao: true,
|
||||||
hjdjakjkdbi: true,
|
hjdjakjkdbi: true,
|
||||||
ldknmcpffim: true,
|
ldknmcpffim: true,
|
||||||
|
|
Loading…
Reference in a new issue