Skip to content

Commit 5283dca

Browse files
author
Boris Sinyapkin
committed
docs: add description of ConfigMap mapping
1 parent daf5a3b commit 5283dca

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/commands/config/apply.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,38 @@ use std::{
1010
process::{self, Command, Stdio},
1111
};
1212

13+
/// Mapping of plugin service names to their properties specified in
14+
/// [plugin configuration](https://github.com/picodata/pike?tab=readme-ov-file#config-apply).
15+
///
16+
/// ### Example:
17+
///
18+
/// Assume plugin configuration YAML has the following content:
19+
///
20+
/// **`plugin_config.yaml`:**
21+
/// ```yaml
22+
/// service_name:
23+
/// http_server:
24+
/// url: "www.example.com"
25+
/// ```
26+
/// Mapping for such config is supposed to look like:
27+
///
28+
/// ```rust,no_run
29+
/// let plugin_config = HashMap::from([(
30+
/// // Name of the service
31+
/// "service_name".to_string(),
32+
///
33+
/// // Mapping of properties corresponding to the service
34+
/// HashMap::from([(
35+
/// "http_server".to_string(),
36+
/// serde_yaml::to_value(HashMap::from([(
37+
/// "url".to_string(),
38+
/// // URL is overridden for testing.
39+
/// "localhost:29092".to_string(),
40+
/// )]))
41+
/// .unwrap(),
42+
/// )]),
43+
/// )]);
44+
/// ```
1345
pub type ConfigMap = HashMap<String, HashMap<String, serde_yaml::Value>>;
1446

1547
const DEFAULT_PLUGIN_CONFIG_PATH: &str = "plugin_config.yaml";

0 commit comments

Comments
 (0)