Skip to content

Commit 25c5dbf

Browse files
committed
fix(gateway): reject enabled Datadog integration without a webhook block
Silently dropping a configured-but-webhook-less integration lets the gateway start with an operator-declared integration missing, so it must fail config resolution loudly instead. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent 32258d9 commit 25c5dbf

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

rsworkspace/crates/trogon-gateway/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,7 @@ fn resolve_datadog_integrations(
17481748
continue;
17491749
}
17501750
let Some(webhook) = integration.webhook else {
1751+
errors.push(ConfigValidationError::missing_integration("datadog", &id, "webhook"));
17511752
continue;
17521753
};
17531754
let Some(token) =

rsworkspace/crates/trogon-gateway/src/config/tests.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,19 @@ fn datadog_empty_webhook_token_is_invalid() {
935935
);
936936
}
937937

938+
#[test]
939+
fn datadog_enabled_integration_without_webhook_block_is_invalid() {
940+
let toml = r#"
941+
[sources.datadog.integrations.primary]
942+
subject_prefix = "datadog-primary"
943+
"#;
944+
let f = write_toml(toml);
945+
let result = load(Some(f.path()));
946+
assert!(
947+
matches!(result, Err(ConfigError::Validation(ref errs)) if errs.iter().any(|e| e.contains("datadog/primary: missing webhook")))
948+
);
949+
}
950+
938951
#[test]
939952
fn datadog_timestamp_tolerance_defaults_to_disabled() {
940953
let f = write_toml(&datadog_toml("datadog-webhook-token"));

0 commit comments

Comments
 (0)