diff options
author | Alex <alex@adnab.me> | 2023-06-02 14:35:00 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-06-02 14:35:00 +0000 |
commit | 44548a9114766b1b58887a1888472ad95847b4f6 (patch) | |
tree | 911954194720e058b49f184c55e477d216a0b778 /src/util/config.rs | |
parent | 9d833bb7efc2c166036db38da89b0b5ac8f466fe (diff) | |
parent | 32ad4538eec9e844edab7e04e03dee9d594ec8fb (diff) | |
download | garage-44548a9114766b1b58887a1888472ad95847b4f6.tar.gz garage-44548a9114766b1b58887a1888472ad95847b4f6.zip |
Merge pull request 'feature: Register consul services with agent API' (#567) from unrob/garage:roberto/consul-agent-registration into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/567
Reviewed-by: Alex <alex@adnab.me>
Diffstat (limited to 'src/util/config.rs')
-rw-r--r-- | src/util/config.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/util/config.rs b/src/util/config.rs index 95835bbb..1da95b2f 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -135,8 +135,19 @@ pub struct AdminConfig { pub trace_sink: Option<String>, } +#[derive(Deserialize, Debug, Clone, Default)] +#[serde(rename_all = "lowercase")] +pub enum ConsulDiscoveryAPI { + #[default] + Catalog, + Agent, +} + #[derive(Deserialize, Debug, Clone)] pub struct ConsulDiscoveryConfig { + /// The consul api to use when registering: either `catalog` (the default) or `agent` + #[serde(default)] + 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 @@ -147,9 +158,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 token: Option<String>, /// Skip TLS hostname verification #[serde(default)] pub tls_skip_verify: bool, + /// Additional tags to add to the service + #[serde(default)] + pub tags: Vec<String>, + /// Additional service metadata to add + #[serde(default)] + pub meta: Option<std::collections::HashMap<String, String>>, } #[derive(Deserialize, Debug, Clone)] @@ -344,7 +363,7 @@ mod tests { replication_mode = "3" rpc_bind_addr = "[::]:3901" rpc_secret_file = "{}" - + [s3_api] s3_region = "garage" api_bind_addr = "[::]:3900" @@ -388,7 +407,7 @@ mod tests { rpc_bind_addr = "[::]:3901" rpc_secret= "dummy" rpc_secret_file = "dummy" - + [s3_api] s3_region = "garage" api_bind_addr = "[::]:3900" |