Skip to content

Commit 0670c40

Browse files
feat: simplify secret definition in zone config
1 parent 70b414a commit 0670c40

File tree

4 files changed

+164
-75
lines changed

4 files changed

+164
-75
lines changed

examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.repl

examples/009/.repl/history.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

implementations/rust/ockam/ockam_command/src/zone/secret.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl SecretCommand {
196196
struct SecretsYaml(BTreeMap<String, String>);
197197

198198
#[derive(Debug, Clone, Serialize, Deserialize)]
199-
struct Secrets(Vec<Secret>);
199+
pub(crate) struct Secrets(Vec<Secret>);
200200

201201
#[derive(Debug, Clone, Serialize, Deserialize)]
202202
struct Secret {
@@ -205,7 +205,7 @@ struct Secret {
205205
}
206206

207207
impl Secrets {
208-
const SIMPLIFIED_FIELD_NAME: &'static str = "value";
208+
pub(crate) const SIMPLIFIED_FIELD_NAME: &'static str = "value";
209209

210210
fn from_contents(contents: &str) -> Result<Self> {
211211
let mut _self = if let Ok(parsed_yaml) = Self::parse_contents::<SecretsYaml>(contents) {
@@ -283,6 +283,9 @@ mod tests {
283283
"#;
284284
let file = create_temp_file_with_content(yaml_content)?;
285285
let secrets = Secrets::from_file(file.path())?;
286+
let _secrets_as_str = serde_yaml::to_string(&secrets)
287+
.into_diagnostic()
288+
.wrap_err("Failed to serialize secrets to YAML")?;
286289

287290
assert_eq!(secrets.0.len(), 2);
288291
let username = secrets.0.iter().find(|s| s.name == "pg_username").unwrap();

0 commit comments

Comments
 (0)