integrate docker and implement state tracking for server lifecycle management
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user