Skip to content

Commit

Permalink
node-support: bootloader: invoke event export sidecar w/ SQS queue URL
Browse files Browse the repository at this point in the history
  • Loading branch information
akirillo committed Dec 17, 2024
1 parent ee85805 commit 1a1746f
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions node-support/bootloader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const ENV_FUNDS_MANAGER_KEY: &str = "FUNDS_MANAGER_KEY";
const ENV_HISTORICAL_STATE_URL: &str = "HISTORICAL_STATE_URL";
/// The historical state engine auth key
const ENV_HISTORICAL_STATE_KEY: &str = "HISTORICAL_STATE_KEY";
/// The SQS queue URL
const ENV_SQS_QUEUE_URL: &str = "SQS_QUEUE_URL";

// --- Constants --- //

Expand Down Expand Up @@ -115,14 +117,28 @@ async fn main() -> Result<(), String> {
.spawn()
.expect("Failed to start snapshot sidecar process");

let hse_url = read_env_var::<String>(ENV_HISTORICAL_STATE_URL)?;
let hse_key = read_env_var::<String>(ENV_HISTORICAL_STATE_KEY)?;
let mut event_export_sidecar = Command::new(EVENT_EXPORT_SIDECAR_BIN)
.args(["--config-path", CONFIG_PATH])
.args(["--hse-url", &hse_url])
.args(["--hse-key", &hse_key])
.spawn()
.expect("Failed to start event export sidecar process");
let mut event_export_sidecar = if is_env_var_set(ENV_SQS_QUEUE_URL) {
let sqs_queue_url = read_env_var::<String>(ENV_SQS_QUEUE_URL)?;

Command::new(EVENT_EXPORT_SIDECAR_BIN)
.args(["--config-path", CONFIG_PATH])
.arg("sqs")
.args(["--queue-url", &sqs_queue_url])
.args(["--region", DEFAULT_AWS_REGION])
.spawn()
.expect("Failed to start event export sidecar process")
} else {
let hse_url = read_env_var::<String>(ENV_HISTORICAL_STATE_URL)?;
let hse_key = read_env_var::<String>(ENV_HISTORICAL_STATE_KEY)?;

Command::new(EVENT_EXPORT_SIDECAR_BIN)
.args(["--config-path", CONFIG_PATH])
.arg("hse")
.args(["--hse-url", &hse_url])
.args(["--hse-key", &hse_key])
.spawn()
.expect("Failed to start event export sidecar process")
};

let mut relayer = Command::new(RELAYER_BIN)
.args(["--config-file", CONFIG_PATH])
Expand Down

0 comments on commit 1a1746f

Please sign in to comment.