diff --git a/packages/server/src/index.js b/packages/server/src/index.js index 21abf3598..de6395df5 100755 --- a/packages/server/src/index.js +++ b/packages/server/src/index.js @@ -29,11 +29,20 @@ if (process.env.ENABLE_GRANTS_SCRAPER === 'true') { if (process.env.ENABLE_GRANTS_DIGEST === 'true') { const generateGrantDigestCron = new CronJob( // once per day at 12:00 UTC - '0 0 12 * * *', emailService.buildAndSendUserSavedSearchGrantDigest, + '0 0 12 * * *', emailService.buildAndSendGrantDigest, ); generateGrantDigestCron.start(); } +if (process.env.ENABLE_SAVED_SEARCH_GRANTS_DIGEST === 'true') { + const generateSavedSearchGrantDigestCron = new CronJob( + // once per day at 13:00 UTC + // one hour after the old grant digest + '0 0 13 * * *', emailService.buildAndSendUserSavedSearchGrantDigest, + ); + generateSavedSearchGrantDigestCron.start(); +} + const cleanGeneratedPdfCron = new CronJob( // once per day at 01:00 '0 1 * * *', diff --git a/terraform/main.tf b/terraform/main.tf index e7e63805e..80d551fd7 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -127,6 +127,7 @@ module "api" { autoscaling_desired_count_maximum = var.api_maximum_task_count enable_grants_scraper = var.api_enable_grants_scraper enable_grants_digest = var.api_enable_grants_digest + enable_saved_search_grants_digest = var.api_enable_saved_search_grants_digest unified_service_tags = local.unified_service_tags datadog_environment_variables = var.api_datadog_environment_variables diff --git a/terraform/modules/gost_api/task.tf b/terraform/modules/gost_api/task.tf index 7f63ed025..20474bba9 100644 --- a/terraform/modules/gost_api/task.tf +++ b/terraform/modules/gost_api/task.tf @@ -44,18 +44,19 @@ module "api_container_definition" { map_environment = merge( { - API_DOMAIN = "https://${var.domain_name}" - AUDIT_REPORT_BUCKET = module.arpa_audit_reports_bucket.bucket_id - DATA_DIR = "/var/data" - ENABLE_GRANTS_DIGEST = var.enable_grants_digest ? "true" : "false" - ENABLE_GRANTS_SCRAPER = "false" - GRANTS_SCRAPER_DATE_RANGE = 7 - GRANTS_SCRAPER_DELAY = 1000 - NODE_OPTIONS = "--max_old_space_size=1024" - NOTIFICATIONS_EMAIL = var.notifications_email_address - PGSSLROOTCERT = "rds-combined-ca-bundle.pem" - VUE_APP_GRANTS_API_URL = module.api_gateway.apigatewayv2_api_api_endpoint - WEBSITE_DOMAIN = "https://${var.website_domain_name}" + API_DOMAIN = "https://${var.domain_name}" + AUDIT_REPORT_BUCKET = module.arpa_audit_reports_bucket.bucket_id + DATA_DIR = "/var/data" + ENABLE_GRANTS_DIGEST = var.enable_grants_digest ? "true" : "false" + ENABLE_SAVED_SEARCH_GRANTS_DIGEST = var.enable_saved_search_grants_digest ? "true" : "false" + ENABLE_GRANTS_SCRAPER = "false" + GRANTS_SCRAPER_DATE_RANGE = 7 + GRANTS_SCRAPER_DELAY = 1000 + NODE_OPTIONS = "--max_old_space_size=1024" + NOTIFICATIONS_EMAIL = var.notifications_email_address + PGSSLROOTCERT = "rds-combined-ca-bundle.pem" + VUE_APP_GRANTS_API_URL = module.api_gateway.apigatewayv2_api_api_endpoint + WEBSITE_DOMAIN = "https://${var.website_domain_name}" }, local.datadog_env_vars, var.api_container_environment, diff --git a/terraform/modules/gost_api/variables.tf b/terraform/modules/gost_api/variables.tf index b88ea50bd..235b62cf3 100644 --- a/terraform/modules/gost_api/variables.tf +++ b/terraform/modules/gost_api/variables.tf @@ -168,6 +168,12 @@ variable "enable_grants_digest" { default = false } +variable "enable_saved_search_grants_digest" { + description = "When true, sets the ENABLE_SAVED_SEARCH_GRANTS_DIGEST environment variable to true in the API container." + type = bool + default = false +} + variable "unified_service_tags" { description = "Datadog unified service tags to apply to runtime environments." type = object({ diff --git a/terraform/prod.tfvars b/terraform/prod.tfvars index 122de4605..da6d847fe 100644 --- a/terraform/prod.tfvars +++ b/terraform/prod.tfvars @@ -38,14 +38,15 @@ website_feature_flags = { cluster_container_insights_enabled = true // API / Backend -api_enabled = true -api_container_image_tag = "stable" -api_default_desired_task_count = 3 -api_minumum_task_count = 2 -api_maximum_task_count = 5 -api_enable_grants_scraper = true -api_enable_grants_digest = true -api_log_retention_in_days = 30 +api_enabled = true +api_container_image_tag = "stable" +api_default_desired_task_count = 3 +api_minumum_task_count = 2 +api_maximum_task_count = 5 +api_enable_grants_scraper = true +api_enable_grants_digest = true +api_enable_saved_search_grants_digest = false +api_log_retention_in_days = 30 api_datadog_environment_variables = { DD_PROFILING_ENABLED = true, } diff --git a/terraform/sandbox.tfvars b/terraform/sandbox.tfvars index edd235b15..0ceab2cff 100644 --- a/terraform/sandbox.tfvars +++ b/terraform/sandbox.tfvars @@ -17,14 +17,15 @@ website_feature_flags = { cluster_container_insights_enabled = false // API / Backend -api_enabled = true -api_container_image_tag = "latest" -api_default_desired_task_count = 1 -api_minumum_task_count = 1 -api_maximum_task_count = 5 -api_enable_grants_scraper = false -api_enable_grants_digest = false -api_log_retention_in_days = 7 +api_enabled = true +api_container_image_tag = "latest" +api_default_desired_task_count = 1 +api_minumum_task_count = 1 +api_maximum_task_count = 5 +api_enable_grants_scraper = false +api_enable_grants_digest = false +api_enable_saved_search_grants_digest = false +api_log_retention_in_days = 7 // Postgres postgres_enabled = true diff --git a/terraform/staging.tfvars b/terraform/staging.tfvars index 06cb84d85..791286840 100644 --- a/terraform/staging.tfvars +++ b/terraform/staging.tfvars @@ -38,14 +38,15 @@ website_feature_flags = { cluster_container_insights_enabled = true // API / Backend -api_enabled = true -api_container_image_tag = "latest" -api_default_desired_task_count = 1 -api_minumum_task_count = 1 -api_maximum_task_count = 5 -api_enable_grants_scraper = false -api_enable_grants_digest = false -api_log_retention_in_days = 14 +api_enabled = true +api_container_image_tag = "latest" +api_default_desired_task_count = 1 +api_minumum_task_count = 1 +api_maximum_task_count = 5 +api_enable_grants_scraper = false +api_enable_grants_digest = false +api_enable_saved_search_grants_digest = true +api_log_retention_in_days = 14 api_datadog_environment_variables = { DD_PROFILING_ENABLED = true, } diff --git a/terraform/variables.tf b/terraform/variables.tf index 0148e9936..aba7df821 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -119,6 +119,10 @@ variable "api_enable_grants_digest" { type = bool } +variable "api_enable_saved_search_grants_digest" { + type = bool +} + variable "api_log_retention_in_days" { type = number }