mirror of
https://codeberg.org/spire/dispenser.git
synced 2026-06-03 18:14:06 +02:00
allow setting extra_cfg
This commit is contained in:
parent
33ccf8d1d1
commit
c00b7b4ab8
3 changed files with 26 additions and 15 deletions
|
|
@ -67,6 +67,11 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Take control of existing server";
|
description = "Take control of existing server";
|
||||||
};
|
};
|
||||||
|
extra_cfg = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "Extra config lines to set in the tf2 config";
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,8 @@ pub struct ServerConfig {
|
||||||
pub ssh_keys: Vec<String>,
|
pub ssh_keys: Vec<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub manage_existing: bool,
|
pub manage_existing: bool,
|
||||||
|
#[serde(default)]
|
||||||
|
pub extra_cfg: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn server_default_image() -> String {
|
fn server_default_image() -> String {
|
||||||
|
|
|
||||||
16
src/main.rs
16
src/main.rs
|
|
@ -102,12 +102,12 @@ async fn setup(
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("starting container");
|
info!("starting container");
|
||||||
let result = ssh
|
|
||||||
.exec(format!(
|
let cmnd = format!(
|
||||||
"docker run --name spire -d \
|
"docker run --name spire -d \
|
||||||
-e NAME={name} -e TV_NAME={tv_name} -e PASSWORD={password} -e RCON_PASSWORD={rcon} \
|
-e NAME={name} -e TV_NAME={tv_name} -e PASSWORD={password} -e RCON_PASSWORD={rcon} \
|
||||||
-e DEMOSTF_APIKEY={demostf} -e LOGSTF_APIKEY={logstf} \
|
-e DEMOSTF_APIKEY={demostf} -e LOGSTF_APIKEY={logstf} \
|
||||||
-e CONFIG_LEAGUE={league} -e CONFIG_MODE={mode} \
|
-e CONFIG_LEAGUE={league} -e CONFIG_MODE={mode} -e 'EXTRA_CFG={extra_cfg}' \
|
||||||
-p 27015:27015 -p 27021:27021 -p 27015:27015/udp -p 27020:27020/udp -p 27025:27025 \
|
-p 27015:27015 -p 27021:27021 -p 27015:27015/udp -p 27020:27020/udp -p 27025:27025 \
|
||||||
-p 28015:27015 -p 28015:27015/udp -p 27115:27015 -p 27115:27015/udp -p 27215:27015 \
|
-p 28015:27015 -p 28015:27015/udp -p 27115:27015 -p 27115:27015/udp -p 27215:27015 \
|
||||||
-p 27215:27015/udp -p 27315:27015 -p 27315:27015/udp -p 27415:27015 -p 27415:27015/udp \
|
-p 27215:27015/udp -p 27315:27015 -p 27315:27015/udp -p 27415:27015 -p 27415:27015/udp \
|
||||||
|
|
@ -123,9 +123,13 @@ async fn setup(
|
||||||
logstf = config.logstf_key.as_deref().unwrap_or_default(),
|
logstf = config.logstf_key.as_deref().unwrap_or_default(),
|
||||||
league = config.config_league,
|
league = config.config_league,
|
||||||
mode = config.config_mode,
|
mode = config.config_mode,
|
||||||
image = config.image
|
image = config.image,
|
||||||
))
|
extra_cfg = config.extra_cfg,
|
||||||
.await?;
|
);
|
||||||
|
|
||||||
|
debug!("running {cmnd}");
|
||||||
|
|
||||||
|
let result = ssh.exec(cmnd).await?;
|
||||||
|
|
||||||
if !result.success() {
|
if !result.success() {
|
||||||
return Err(Error::SetupError(result.output()));
|
return Err(Error::SetupError(result.output()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue