summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6326fa0..c320936 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,6 @@
-mod catalog;
+pub mod catalog;
+pub mod locking;
mod kv;
-mod locking;
mod with_index;
use std::fs::File;
@@ -10,14 +10,23 @@ use anyhow::{bail, Result};
pub use with_index::WithIndex;
-pub struct ConsulConfig {
+/// Configuration parameters to talk to a Consul server
+pub struct Config {
+ /// HTTP address of the Consul server, with `http://` or `https://` prefix
pub addr: String,
+ /// CA certificate of the Consul CA, when using TLS
pub ca_cert: Option<String>,
- pub tls_skip_verify: bool,
+ /// Client certificate for client auth when using TLS
pub client_cert: Option<String>,
+ /// Client key for client auth when using TLS
pub client_key: Option<String>,
+ /// Skip verification of consul server TLS certificates
+ pub tls_skip_verify: bool,
}
+/// Client used to talk to a Consul server.
+/// All calls to the key/value API are automatically prefixed with an arbitrary string
+/// that is constructed at client creation.
#[derive(Clone)]
pub struct Consul {
client: reqwest::Client,
@@ -27,7 +36,7 @@ pub struct Consul {
}
impl Consul {
- pub fn new(config: ConsulConfig, kv_prefix: &str) -> Result<Self> {
+ pub fn new(config: Config, kv_prefix: &str) -> Result<Self> {
let client = match (&config.client_cert, &config.client_key) {
(Some(client_cert), Some(client_key)) => {
let mut client_cert_buf = vec![];