Skip to content

Commit 45e67da

Browse files
docs: add a docstring for the last missing function Consul::with_local_config (#386)
1 parent c31afbc commit 45e67da

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/consul/mod.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,28 @@ pub struct Consul {
2828
}
2929

3030
impl Consul {
31-
// not having docs here is currently allowed to address the missing docs problem one place at a time. Helping us by documenting just one of these places helps other devs tremendously
32-
#[allow(missing_docs)]
33-
pub fn with_local_config(self, config: String) -> Self {
31+
/// Passes a JSON string of configuration options to the Consul agent
32+
///
33+
/// For details on which options are avalible, please see [the consul docs](https://developer.hashicorp.com/consul/docs/reference/agent/configuration-file).
34+
///
35+
/// # Example
36+
/// ```
37+
/// use testcontainers_modules::{consul, testcontainers::runners::SyncRunner};
38+
///
39+
/// let consul = consul::Consul::default()
40+
/// .with_local_config(
41+
/// r#"{
42+
/// "datacenter": "us_west",
43+
/// "server": true,
44+
/// "enable_debug": true
45+
/// }"#,
46+
/// )
47+
/// .start()
48+
/// .unwrap();
49+
/// ```
50+
pub fn with_local_config(self, config: impl ToString) -> Self {
3451
let mut env_vars = self.env_vars;
35-
env_vars.insert(CONSUL_LOCAL_CONFIG.to_owned(), config);
52+
env_vars.insert(CONSUL_LOCAL_CONFIG.to_owned(), config.to_string());
3653
Self { env_vars }
3754
}
3855
}

0 commit comments

Comments
 (0)