feat(protocol): KDL parser for ServerConfig
Adds kdl_parse module with parse_server_config() that deserialises a KDL document into ServerConfig, with full validation of name, types, durations, and restart/stop blocks. Also derives Default on RestartPolicy to satisfy clippy.
This commit is contained in:
@@ -1,20 +1,15 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum RestartPolicy {
|
||||
Always,
|
||||
#[default]
|
||||
OnFailure,
|
||||
Never,
|
||||
}
|
||||
|
||||
impl Default for RestartPolicy {
|
||||
fn default() -> Self {
|
||||
RestartPolicy::OnFailure
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct RestartConfig {
|
||||
#[serde(default)]
|
||||
|
||||
Reference in New Issue
Block a user