diff options
author | Alex Auvolat <alex@adnab.me> | 2023-06-13 17:02:42 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-06-13 17:14:11 +0200 |
commit | 90b2d43eb49d49c3aef4f501a30cf2f181adb183 (patch) | |
tree | f7f7c15547e2f2072a1841fcb2350c272faf3c9d /src/util/config.rs | |
parent | bf19a44fd93584d5250a2e98e5b1d3a2de6d59d1 (diff) | |
parent | 01346143ca09eab262f0d8f8a0a744c2f6d667cc (diff) | |
download | garage-90b2d43eb49d49c3aef4f501a30cf2f181adb183.tar.gz garage-90b2d43eb49d49c3aef4f501a30cf2f181adb183.zip |
Merge branch 'main' into next
Diffstat (limited to 'src/util/config.rs')
-rw-r--r-- | src/util/config.rs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/util/config.rs b/src/util/config.rs index 009f0574..eeb17e0e 100644 --- a/src/util/config.rs +++ b/src/util/config.rs @@ -142,8 +142,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 @@ -154,9 +165,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)] @@ -230,7 +249,7 @@ fn secret_from_file( #[cfg(unix)] if std::env::var("GARAGE_ALLOW_WORLD_READABLE_SECRETS").as_deref() != Ok("true") { use std::os::unix::fs::MetadataExt; - let metadata = std::fs::metadata(&file_path)?; + let metadata = std::fs::metadata(file_path)?; if metadata.mode() & 0o077 != 0 { return Err(format!("File {} is world-readable! (mode: 0{:o}, expected 0600)\nRefusing to start until this is fixed, or environment variable GARAGE_ALLOW_WORLD_READABLE_SECRETS is set to true.", file_path, metadata.mode()).into()); } @@ -351,7 +370,7 @@ mod tests { replication_mode = "3" rpc_bind_addr = "[::]:3901" rpc_secret_file = "{}" - + [s3_api] s3_region = "garage" api_bind_addr = "[::]:3900" @@ -395,7 +414,7 @@ mod tests { rpc_bind_addr = "[::]:3901" rpc_secret= "dummy" rpc_secret_file = "dummy" - + [s3_api] s3_region = "garage" api_bind_addr = "[::]:3900" |