Skip to content

Commit

Permalink
chore: add featureflag for new search notification (#1917)
Browse files Browse the repository at this point in the history
  • Loading branch information
as1729 authored Sep 14, 2023
1 parent 6b9346e commit 3678aa3
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 37 deletions.
11 changes: 10 additions & 1 deletion packages/server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 * * *',
Expand Down
1 change: 1 addition & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 13 additions & 12 deletions terraform/modules/gost_api/task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/gost_api/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
17 changes: 9 additions & 8 deletions terraform/prod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
17 changes: 9 additions & 8 deletions terraform/sandbox.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions terraform/staging.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
4 changes: 4 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3678aa3

Please sign in to comment.