From 391b343e16df5f2106969df16c012e440dc63a8f Mon Sep 17 00:00:00 2001 From: Davide Dippolito Date: Fri, 20 Dec 2024 10:37:28 +0000 Subject: [PATCH] Remove unnecessary Big Query environment variable --- .env.example | 2 +- app/services/publishers/dfe_sign_in/big_query_export/base.rb | 2 +- app/services/publishers/vacancy_stats.rb | 2 +- config/application.rb | 2 -- config/environments/test.rb | 2 +- terraform/workspace-variables/production_app_env.yml | 2 +- terraform/workspace-variables/qa_app_env.yml | 2 +- terraform/workspace-variables/review_app_env.yml | 2 +- terraform/workspace-variables/staging_app_env.yml | 2 +- 9 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.env.example b/.env.example index 6b28cc2df4..ea21bceb90 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ AUTHENTICATION_FALLBACK= BIG_QUERY_API_JSON_KEY= -BIG_QUERY_DATASET= +BIGQUERY_DATASET= DATABASE_URL= DFE_SIGN_IN_HIRING_STAFF_ROLE_ID= DFE_SIGN_IN_IDENTIFIER= diff --git a/app/services/publishers/dfe_sign_in/big_query_export/base.rb b/app/services/publishers/dfe_sign_in/big_query_export/base.rb index d25d9440f8..cae84bad57 100644 --- a/app/services/publishers/dfe_sign_in/big_query_export/base.rb +++ b/app/services/publishers/dfe_sign_in/big_query_export/base.rb @@ -11,7 +11,7 @@ class Base attr_reader :dataset def initialize(bigquery: Google::Cloud::Bigquery.new) - @dataset = bigquery.dataset(Rails.configuration.big_query_dataset) + @dataset = bigquery.dataset(Rails.configuration.bigquery_dataset) end private diff --git a/app/services/publishers/vacancy_stats.rb b/app/services/publishers/vacancy_stats.rb index 25a5c1b566..4c73ce8ae1 100644 --- a/app/services/publishers/vacancy_stats.rb +++ b/app/services/publishers/vacancy_stats.rb @@ -18,7 +18,7 @@ def number_of_unique_views # with the Vacancy anonymised id to the new views associated with the real Vacancy id. sql = <<~SQL SELECT SUM(#{field}) AS #{field} - FROM `#{Rails.configuration.big_query_dataset}.#{TABLE_NAME}` + FROM `#{Rails.configuration.bigquery_dataset}.#{TABLE_NAME}` WHERE id IN ("#{vacancy.id}", "#{StringAnonymiser.new(vacancy.id)}") AND publish_on = "#{vacancy.publish_on.iso8601}" SQL diff --git a/config/application.rb b/config/application.rb index 6dd6a9ef59..b131cb0873 100644 --- a/config/application.rb +++ b/config/application.rb @@ -124,8 +124,6 @@ class Application < Rails::Application config.analytics = config_for(:analytics) config.analytics_pii = config_for(:analytics_pii) - config.big_query_dataset = ENV.fetch("BIG_QUERY_DATASET", nil) - config.enforce_local_authority_allowlist = ActiveModel::Type::Boolean.new.cast(ENV.fetch("ENFORCE_LOCAL_AUTHORITY_ALLOWLIST", nil)) config.geocoder_lookup = :default diff --git a/config/environments/test.rb b/config/environments/test.rb index 8319213c25..0701aa4cf9 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -62,7 +62,7 @@ config.middleware.use RackSessionAccess::Middleware - config.big_query_dataset = "test_dataset" + config.bigquery_dataset = "test_dataset" # Use test geocoder lookup, unless otherwise specified config.geocoder_lookup = :test diff --git a/terraform/workspace-variables/production_app_env.yml b/terraform/workspace-variables/production_app_env.yml index af505acb33..df9a821609 100644 --- a/terraform/workspace-variables/production_app_env.yml +++ b/terraform/workspace-variables/production_app_env.yml @@ -2,7 +2,7 @@ APP_ROLE: production AUTHENTICATION_FALLBACK: false AUTHENTICATION_FALLBACK_FOR_JOBSEEKERS: false -BIG_QUERY_DATASET: production_dataset +BIGQUERY_DATASET: production_dataset DFE_SIGN_IN_ISSUER: https://oidc.signin.education.gov.uk DFE_SIGN_IN_REDIRECT_URL: https://teaching-vacancies.service.gov.uk/auth/dfe/callback DFE_SIGN_IN_REGISTRATION_URL: https://profile.signin.education.gov.uk/register diff --git a/terraform/workspace-variables/qa_app_env.yml b/terraform/workspace-variables/qa_app_env.yml index c795a79051..a0795b7edd 100644 --- a/terraform/workspace-variables/qa_app_env.yml +++ b/terraform/workspace-variables/qa_app_env.yml @@ -2,7 +2,7 @@ APP_ROLE: qa AUTHENTICATION_FALLBACK: false AUTHENTICATION_FALLBACK_FOR_JOBSEEKERS: false -BIG_QUERY_DATASET: staging_dataset +BIGQUERY_DATASET: staging_dataset DFE_SIGN_IN_ISSUER: https://test-oidc.signin.education.gov.uk DFE_SIGN_IN_REDIRECT_URL: https://qa.teaching-vacancies.service.gov.uk/auth/dfe/callback DFE_SIGN_IN_REGISTRATION_URL: https://test-profile.signin.education.gov.uk/register diff --git a/terraform/workspace-variables/review_app_env.yml b/terraform/workspace-variables/review_app_env.yml index 41f107060b..158be032a6 100644 --- a/terraform/workspace-variables/review_app_env.yml +++ b/terraform/workspace-variables/review_app_env.yml @@ -2,7 +2,7 @@ APP_ROLE: review AUTHENTICATION_FALLBACK: true AUTHENTICATION_FALLBACK_FOR_JOBSEEKERS: true -BIG_QUERY_DATASET: staging_dataset +BIGQUERY_DATASET: staging_dataset DFE_SIGN_IN_REGISTRATION_URL: https://test-profile.signin.education.gov.uk/register DISABLE_DATABASE_ENVIRONMENT_CHECK: 1 DISABLE_EMAILS: false diff --git a/terraform/workspace-variables/staging_app_env.yml b/terraform/workspace-variables/staging_app_env.yml index 72ee3ceedd..219d167735 100644 --- a/terraform/workspace-variables/staging_app_env.yml +++ b/terraform/workspace-variables/staging_app_env.yml @@ -2,7 +2,7 @@ APP_ROLE: staging AUTHENTICATION_FALLBACK: false AUTHENTICATION_FALLBACK_FOR_JOBSEEKERS: false -BIG_QUERY_DATASET: staging_dataset +BIGQUERY_DATASET: staging_dataset DFE_SIGN_IN_ISSUER: https://pp-oidc.signin.education.gov.uk DFE_SIGN_IN_REDIRECT_URL: https://staging.teaching-vacancies.service.gov.uk/auth/dfe/callback DFE_SIGN_IN_REGISTRATION_URL: https://pp-profile.signin.education.gov.uk/register