diff options
author | Roberto Hidalgo <un@rob.mx> | 2023-05-15 16:15:56 -0600 |
---|---|---|
committer | Roberto Hidalgo <un@rob.mx> | 2023-05-22 08:57:15 -0600 |
commit | b7705041268e49f2a5ba9a719372048f85c3de83 (patch) | |
tree | 37b871c90a454ec098caeee2edd6c7085268235c /src/util/config.rs | |
parent | 6b69404f1a53b927b4ce3cabdbb41f58e832a963 (diff) | |
download | garage-b7705041268e49f2a5ba9a719372048f85c3de83.tar.gz garage-b7705041268e49f2a5ba9a719372048f85c3de83.zip |
simplify code according to feedback
Diffstat (limited to 'src/util/config.rs')
-rw-r--r-- | src/util/config.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/util/config.rs b/src/util/config.rs index 8b723e47..647c2659 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -135,23 +135,18 @@ pub struct AdminConfig { pub trace_sink: Option<String>, } -#[derive(Deserialize, Debug, Clone)] +#[derive(Deserialize, Debug, Clone, Default)] +#[serde(rename_all = "lowercase")] pub enum ConsulDiscoveryAPI { - #[serde(rename_all = "lowercase")] + #[default] Catalog, Agent, } -impl ConsulDiscoveryAPI { - fn default() -> Self { - ConsulDiscoveryAPI::Catalog - } -} #[derive(Deserialize, Debug, Clone)] pub struct ConsulDiscoveryConfig { /// The consul api to use when registering: either `catalog` (the default) or `agent` - #[serde(default = "ConsulDiscoveryAPI::default")] - pub consul_http_api: ConsulDiscoveryAPI, + pub api: ConsulDiscoveryAPI, /// Consul http or https address to connect to to discover more peers pub consul_http_addr: String, /// Consul service name to use @@ -163,7 +158,7 @@ pub struct ConsulDiscoveryConfig { /// Client TLS key to use when connecting to Consul pub client_key: Option<String>, /// /// Token to use for connecting to consul - pub consul_http_token: Option<String>, + pub token: Option<String>, /// Skip TLS hostname verification #[serde(default)] pub tls_skip_verify: bool, |