diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9cbb7..ca3d414 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - Implemented a new metric, `iocaine_maze_depth`, a counter to track how deep the maze has been explored so far. - When metrics are enabled, process metrics such as CPU seconds used, memory usage, etc, are also emitted. +### Fixed + +- The default bind address, both for the main service, and for metrics, are now correctly initialized with a default. + ## [1.0.0] - 2025-03-01 _Initial release._ diff --git a/src/config.rs b/src/config.rs index c1ea183..f607cda 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,13 +19,13 @@ pub struct Config { pub metrics: MetricsConfig, } -#[derive(Clone, Debug, Deserialize, Default)] +#[derive(Clone, Debug, Deserialize)] pub struct ServerConfig { #[serde(default = "ServerConfig::default_bind")] pub bind: String, } -#[derive(Clone, Debug, Deserialize, Default)] +#[derive(Clone, Debug, Deserialize)] pub struct MetricsConfig { #[serde(default)] pub enable: bool, @@ -43,6 +43,17 @@ impl MetricsConfig { } } +impl Default for MetricsConfig { + fn default() -> Self { + Self { + enable: Default::default(), + labels: Default::default(), + bind: Self::default_bind(), + agent_group: Default::default(), + } + } +} + #[derive(Clone, Debug, Deserialize, PartialEq)] pub enum MetricsLabel { Host, @@ -63,6 +74,14 @@ impl ServerConfig { } } +impl Default for ServerConfig { + fn default() -> Self { + Self { + bind: Self::default_bind(), + } + } +} + #[derive(Clone, Debug, Deserialize)] pub struct SourceConfig { pub markov: Vec,