integrate docker and implement state tracking for server lifecycle management

This commit is contained in:
2026-02-02 17:00:32 +01:00
parent 84b56a163a
commit 753d9e1e64
10 changed files with 756 additions and 93 deletions

View File

@@ -1,5 +1,5 @@
use std::error::Error;
use std::fs;
use anyhow::Result;
use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
@@ -11,10 +11,26 @@ pub struct Config {
pub rcon_password: String,
pub idle_timeout_secs: u64,
pub polling_interval_millis: u64,
pub container_name: String,
#[serde(default = "default_startup_timeout_secs")]
pub startup_timeout_secs: u64,
#[serde(default = "default_rcon_retry_interval_secs")]
pub rcon_retry_interval_secs: u64,
}
fn default_startup_timeout_secs() -> u64 {
600
}
fn default_rcon_retry_interval_secs() -> u64 {
1
}
impl Config {
pub fn load(path: &str) -> Result<Self, Box<dyn Error>> {
pub fn load(path: &str) -> Result<Self> {
let content = fs::read_to_string(path)?;
let config: Config = toml::from_str(&content)?;
Ok(config)