diff --git a/docs/proxy-configuration.md b/docs/proxy-configuration.md index 5ef68fabe7..a8ff3dade0 100644 --- a/docs/proxy-configuration.md +++ b/docs/proxy-configuration.md @@ -29,18 +29,13 @@ properties: admin: type: object description: | - Configuration of operational proxy behavior. + Configuration of proxy admin HTTP interface. properties: - metrics: - type: object + address: + type: string description: | - Metrics related configuration. - properties: - port: - type: integer - description: | - Port on which to expose metrics. - default: 9091 + Socket Address and port to bind the administration interface to. + default: [::]:9091 static: type: object description: | diff --git a/src/config/builder.rs b/src/config/builder.rs index 3687224e31..dac3014b93 100644 --- a/src/config/builder.rs +++ b/src/config/builder.rs @@ -15,13 +15,14 @@ */ use super::{Config, Filter}; -use crate::config::{EndPoint, Proxy, Source, Version}; +use crate::config::{Admin, EndPoint, Proxy, Source, Version}; /// Builder for a [`Config`] #[derive(Debug)] pub struct Builder { pub port: u16, pub source: Source, + pub admin: Admin, } impl Builder { @@ -29,6 +30,7 @@ impl Builder { pub fn empty() -> Self { Builder { port: 0, + admin: Admin::default(), source: Source::Static { filters: vec![], endpoints: vec![], @@ -52,7 +54,7 @@ impl Builder { id: "test".into(), port: self.port, }, - admin: None, + admin: self.admin, source: self.source, phantom: None, } diff --git a/src/config/mod.rs b/src/config/mod.rs index f7574f9fdb..3f767276b3 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -69,13 +69,16 @@ impl Default for Proxy { } #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct AdminAddress { - port: u16, +pub struct Admin { + pub address: SocketAddr, } -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct Admin { - address: Option, +impl Default for Admin { + fn default() -> Self { + Admin { + address: "[::]:9091".parse().unwrap(), + } + } } #[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] @@ -106,7 +109,8 @@ pub struct Config { #[serde(default)] pub proxy: Proxy, - pub admin: Option, + #[serde(default)] + pub admin: Admin, #[serde(flatten)] pub source: Source, diff --git a/src/proxy/builder.rs b/src/proxy/builder.rs index c023f70e0e..65031b8457 100644 --- a/src/proxy/builder.rs +++ b/src/proxy/builder.rs @@ -45,7 +45,7 @@ pub(super) enum ValidatedSource { pub(super) struct ValidatedConfig { pub version: Version, pub proxy: Proxy, - pub admin: Option, + pub admin: Admin, pub source: ValidatedSource, // Limit struct creation to the builder. pub phantom: PhantomData<()>,