From 63b705bba326acebea99468dcf8b82a4d81914c5 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Mon, 13 Nov 2023 09:32:35 -0300 Subject: [PATCH] add macros --- crates/orchestrator/src/shared/macros.rs | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 crates/orchestrator/src/shared/macros.rs diff --git a/crates/orchestrator/src/shared/macros.rs b/crates/orchestrator/src/shared/macros.rs new file mode 100644 index 000000000..f79b3a1aa --- /dev/null +++ b/crates/orchestrator/src/shared/macros.rs @@ -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, + /// Command to run the node + pub command: Option, + /// Arguments to pass to the node + pub args: Vec, + /// Env vars to set + pub env: Vec, + /// 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, + /// Prometheus port to use, if None a random one will be set + pub prometheus_port: Option, + /// P2P port to use, if None a random one will be set + pub p2p_port: Option, + $( + pub $field: $type, + )* + } + }; +} + +pub(crate) use create_add_options;