From 7eb12b0a8898a37affc5d4c23c01ae5c75d254ae Mon Sep 17 00:00:00 2001 From: NathanFlurry Date: Wed, 19 Jun 2024 22:32:26 +0000 Subject: [PATCH] feat(better_uptime): allow disabling notifications (#923) ## Changes --- infra/tf/better_uptime/main.tf | 2 ++ infra/tf/better_uptime/vars.tf | 5 +++++ lib/bolt/config/src/ns.rs | 4 ++++ lib/bolt/core/src/dep/terraform/gen.rs | 2 ++ 4 files changed, 13 insertions(+) diff --git a/infra/tf/better_uptime/main.tf b/infra/tf/better_uptime/main.tf index 0fa8ddcf23..27fb242e29 100644 --- a/infra/tf/better_uptime/main.tf +++ b/infra/tf/better_uptime/main.tf @@ -62,6 +62,8 @@ resource "betteruptime_monitor" "monitor" { value = "Bearer ${module.betteruptime_secrets.values["rivet/api_status/token"]}" } ] + email = var.better_uptime_notify + push = var.better_uptime_notify } resource "betteruptime_status_page_resource" "status_page_resource" { diff --git a/infra/tf/better_uptime/vars.tf b/infra/tf/better_uptime/vars.tf index dad23a9f82..db0c2d8e99 100644 --- a/infra/tf/better_uptime/vars.tf +++ b/infra/tf/better_uptime/vars.tf @@ -18,3 +18,8 @@ variable "better_uptime" { company_subdomain = string }) } + +variable "better_uptime_notify" { + type = bool +} + diff --git a/lib/bolt/config/src/ns.rs b/lib/bolt/config/src/ns.rs index d49c270cfa..66a8706817 100644 --- a/lib/bolt/config/src/ns.rs +++ b/lib/bolt/config/src/ns.rs @@ -744,6 +744,10 @@ pub struct BetterUptime { /// It needs to be unique across all of Better Uptime. This is required /// by Better Uptime. pub company_subdomain: String, + /// If we should send push notifications. + /// + /// SHould be disabled for staging environments. + pub notify: bool, } fn default_docker_repo() -> String { diff --git a/lib/bolt/core/src/dep/terraform/gen.rs b/lib/bolt/core/src/dep/terraform/gen.rs index 2f889ca4a5..c3d6c5b496 100644 --- a/lib/bolt/core/src/dep/terraform/gen.rs +++ b/lib/bolt/core/src/dep/terraform/gen.rs @@ -579,6 +579,8 @@ async fn vars(ctx: &ProjectContext) { ); vars.insert("better_uptime".into(), json!(better_uptime.to_owned())); + + vars.insert("better_uptime_notify".into(), json!(better_uptime.notify)); } // Imagor