mirror of
https://github.com/YGGverse/hlstate-rs.git
synced 2026-03-31 09:05:42 +00:00
make xash3d-query script path configurable
This commit is contained in:
parent
44a60cff11
commit
9caeb461d3
4 changed files with 11 additions and 3 deletions
|
|
@ -9,4 +9,8 @@ port = 8027
|
||||||
# Configure instance in the debug mode
|
# Configure instance in the debug mode
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
|
# Path to `xash3d-query` bin
|
||||||
|
query = "xash3d-query"
|
||||||
|
|
||||||
|
# Define at least one master to scrape game servers from
|
||||||
masters = ["[202:68d0:f0d5:b88d:1d1a:555e:2f6b:3148]:27010", "[300:dee4:d3c0:953b::2019]:27010"]
|
masters = ["[202:68d0:f0d5:b88d:1d1a:555e:2f6b:3148]:27010", "[300:dee4:d3c0:953b::2019]:27010"]
|
||||||
|
|
@ -2,6 +2,7 @@ use rocket::serde::Deserialize;
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
net::{IpAddr, SocketAddr},
|
net::{IpAddr, SocketAddr},
|
||||||
|
path::PathBuf,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
|
|
@ -11,5 +12,6 @@ pub struct Config {
|
||||||
pub host: IpAddr,
|
pub host: IpAddr,
|
||||||
pub masters: HashSet<SocketAddr>,
|
pub masters: HashSet<SocketAddr>,
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
|
pub query: PathBuf,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
use rocket::serde::Serialize;
|
use rocket::serde::Serialize;
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, path::PathBuf};
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
#[serde(crate = "rocket::serde")]
|
#[serde(crate = "rocket::serde")]
|
||||||
pub struct Global {
|
pub struct Global {
|
||||||
pub masters: HashSet<std::net::SocketAddr>,
|
pub masters: HashSet<std::net::SocketAddr>,
|
||||||
|
pub query: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ use rocket_dyn_templates::{Template, context};
|
||||||
fn index(meta: &State<Meta>, global: &State<Global>) -> Result<Template, Status> {
|
fn index(meta: &State<Meta>, global: &State<Global>) -> Result<Template, Status> {
|
||||||
// @TODO: requires library impl
|
// @TODO: requires library impl
|
||||||
// https://github.com/FWGS/xash3d-master/issues/4
|
// https://github.com/FWGS/xash3d-master/issues/4
|
||||||
let scrape = std::process::Command::new("xash3d-query")
|
let scrape = std::process::Command::new(&global.query)
|
||||||
.arg("all")
|
.arg("all")
|
||||||
.arg("-M")
|
.arg("-M")
|
||||||
.arg(
|
.arg(
|
||||||
|
|
@ -78,6 +78,7 @@ fn rocket() -> _ {
|
||||||
})
|
})
|
||||||
.manage(Global {
|
.manage(Global {
|
||||||
masters: config.masters,
|
masters: config.masters,
|
||||||
|
query: config.query,
|
||||||
})
|
})
|
||||||
.manage(Meta {
|
.manage(Meta {
|
||||||
title: config.title,
|
title: config.title,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue