Skip to content

Commit

Permalink
add macros
Browse files Browse the repository at this point in the history
  • Loading branch information
pepoviola committed Nov 13, 2023
1 parent 7e1f890 commit 63b705b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions crates/orchestrator/src/shared/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
macro_rules! create_add_options {
($struct:ident {$( $field:ident:$type:ty ),*}) =>{
#[derive(Default, Debug, Clone)]
pub struct $struct {
/// Image to run the node
pub image: Option<Image>,
/// Command to run the node
pub command: Option<Command>,
/// Arguments to pass to the node
pub args: Vec<Arg>,
/// Env vars to set
pub env: Vec<EnvVar>,
/// Make the node a validator
///
/// This implies `--validator` or `--collator`
pub is_validator: bool,
/// RPC port to use, if None a random one will be set
pub rpc_port: Option<Port>,
/// Prometheus port to use, if None a random one will be set
pub prometheus_port: Option<Port>,
/// P2P port to use, if None a random one will be set
pub p2p_port: Option<Port>,
$(
pub $field: $type,
)*
}
};
}

pub(crate) use create_add_options;

0 comments on commit 63b705b

Please sign in to comment.