aboutsummaryrefslogtreecommitdiff
path: root/src/util/config.rs
diff options
context:
space:
mode:
authorRoberto Hidalgo <un@rob.mx>2023-05-10 13:20:39 -0600
committerRoberto Hidalgo <un@rob.mx>2023-05-22 08:57:15 -0600
commitfd7dbea5b86ed8757e76e1114e2154538c5a3c16 (patch)
treef6054f2cee61bcd7e692cd9f52915dcbad0d0d09 /src/util/config.rs
parentbd6485565e78c0bbb9ee830c4e5b114c6248dc97 (diff)
downloadgarage-fd7dbea5b86ed8757e76e1114e2154538c5a3c16.tar.gz
garage-fd7dbea5b86ed8757e76e1114e2154538c5a3c16.zip
follow feedback, fold into existing feature
Diffstat (limited to 'src/util/config.rs')
-rw-r--r--src/util/config.rs39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/util/config.rs b/src/util/config.rs
index 84a8e34f..632d22ef 100644
--- a/src/util/config.rs
+++ b/src/util/config.rs
@@ -56,9 +56,6 @@ pub struct Config {
/// Configuration for automatic node discovery through Consul
#[serde(default)]
pub consul_discovery: Option<ConsulDiscoveryConfig>,
- /// Configuration for automatic node discovery through Consul
- #[serde(default)]
- pub consul_service_discovery: Option<ConsulServiceConfig>,
/// Configuration for automatic node discovery through Kubernetes
#[serde(default)]
pub kubernetes_discovery: Option<KubernetesDiscoveryConfig>,
@@ -139,7 +136,22 @@ pub struct AdminConfig {
}
#[derive(Deserialize, Debug, Clone)]
+pub enum ConsulDiscoveryMode {
+ #[serde(rename_all = "lowercase")]
+ Node,
+ Service,
+}
+impl ConsulDiscoveryMode {
+ fn default() -> Self {
+ ConsulDiscoveryMode::Node
+ }
+}
+
+#[derive(Deserialize, Debug, Clone)]
pub struct ConsulDiscoveryConfig {
+ /// Mode of consul operation: either `node` (the default) or `service`
+ #[serde(default = "ConsulDiscoveryMode::default")]
+ pub mode: ConsulDiscoveryMode,
/// Consul http or https address to connect to to discover more peers
pub consul_http_addr: String,
/// Consul service name to use
@@ -150,30 +162,17 @@ pub struct ConsulDiscoveryConfig {
pub client_cert: Option<String>,
/// 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>,
/// Skip TLS hostname verification
#[serde(default)]
pub tls_skip_verify: bool,
-}
-
-#[derive(Deserialize, Debug, Clone)]
-pub struct ConsulServiceConfig {
- /// Consul http or https address to connect to to discover more peers
- pub consul_http_addr: String,
- /// Token to use for connecting to consul
- pub consul_http_token: Option<String>,
- /// Consul service name to use
- pub service_name: String,
- /// CA TLS certificate to use when connecting to Consul
- pub ca_cert: Option<String>,
- // Additional tags to add to the service
+ /// Additional tags to add to the service
#[serde(default)]
pub tags: Vec<String>,
- // Additional service metadata to add
+ /// Additional service metadata to add
#[serde(default)]
pub meta: Option<std::collections::HashMap<String, String>>,
- /// Skip TLS hostname verification
- #[serde(default)]
- pub tls_skip_verify: bool,
}
#[derive(Deserialize, Debug, Clone)]