Skip to content

Commit

Permalink
parse array from config (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
philsippl authored Oct 29, 2024
1 parent 7a61c88 commit af2cf25
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env.mpc1.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ SMPC__KMS_KEY_ARNS='["arn:aws:kms:eu-north-1:654654380399:key/a7dd6e20-18cb-4e72
NCCL_COMM_ID=10.15.32.27:4000

# RUST config
RUST_LOG=info
RUST_LOG=info
2 changes: 1 addition & 1 deletion deploy/prod/common-values-iris-mpc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.8.33"
image: "ghcr.io/worldcoin/iris-mpc:v0.8.34"

environment: prod
replicaCount: 1
Expand Down
2 changes: 1 addition & 1 deletion deploy/stage/common-values-iris-mpc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "ghcr.io/worldcoin/iris-mpc:v0.8.33"
image: "ghcr.io/worldcoin/iris-mpc:v0.8.34"

environment: stage
replicaCount: 1
Expand Down
12 changes: 10 additions & 2 deletions iris-mpc-common/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::config::json_wrapper::JsonStrWrapper;
use clap::Parser;
use serde::{Deserialize, Serialize};
use serde::{Deserialize, Deserializer, Serialize};
use std::fmt;

pub mod json_wrapper;
Expand Down Expand Up @@ -73,7 +73,7 @@ pub struct Config {
#[serde(default)]
pub disable_persistence: bool,

#[serde(default)]
#[serde(default, deserialize_with = "deserialize_yaml_json_string")]
pub node_hostnames: Vec<String>,
}

Expand Down Expand Up @@ -175,3 +175,11 @@ pub struct MetricsConfig {
pub buffer_size: usize,
pub prefix: String,
}

fn deserialize_yaml_json_string<'de, D>(deserializer: D) -> Result<Vec<String>, D::Error>
where
D: Deserializer<'de>,
{
let value: String = Deserialize::deserialize(deserializer)?;
serde_json::from_str(&value).map_err(serde::de::Error::custom)
}

0 comments on commit af2cf25

Please sign in to comment.