-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Neill Turner
committed
Dec 20, 2024
1 parent
e36080a
commit 7078e96
Showing
4 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,58 @@ | ||
require "hosting_environment" | ||
|
||
DfE::Analytics.configure do |config| | ||
config.queue = :analytics | ||
config.environment = HostingEnvironment.environment_name | ||
# Whether to log events instead of sending them to BigQuery. | ||
# | ||
config.log_only = false | ||
|
||
# Whether to use ActiveJob or dispatch events immediately. | ||
# | ||
config.async = true | ||
config.entity_table_checks_enabled = true | ||
|
||
config.enable_analytics = | ||
proc do | ||
disabled_by_default = Rails.env.development? | ||
ENV.fetch("BIGQUERY_DISABLE", disabled_by_default.to_s) != "true" | ||
end | ||
# Which ActiveJob queue to put events on | ||
# | ||
config.queue = :analytics | ||
|
||
# The name of the BigQuery table we’re writing to. | ||
# | ||
# config.bigquery_table_name = ENV['BIGQUERY_TABLE_NAME'] | ||
|
||
# The name of the BigQuery project we’re writing to. | ||
# | ||
# config.bigquery_project_id = ENV['BIGQUERY_PROJECT_ID'] | ||
|
||
# The name of the BigQuery dataset we're writing to. | ||
# | ||
# config.bigquery_dataset = ENV['BIGQUERY_DATASET'] | ||
|
||
# Service account JSON key for the BigQuery API. See | ||
# https://cloud.google.com/bigquery/docs/authentication/service-account-file | ||
# | ||
# We base64 encode the secret otherwise the raw JSON is mangled when it gets | ||
# written to/read from the Azure keyvault. | ||
config.bigquery_api_json_key = ENV['BIGQUERY_API_JSON_KEY'] ? Base64.decode64(ENV['BIGQUERY_API_JSON_KEY']) : nil | ||
|
||
# Passed directly to the retries: option on the BigQuery client | ||
# | ||
# config.bigquery_retries = 3 | ||
|
||
# Passed directly to the timeout: option on the BigQuery client | ||
# | ||
# config.bigquery_timeout = 120 | ||
|
||
# A proc which returns true or false depending on whether you want to | ||
# enable analytics. You might want to hook this up to a feature flag or | ||
# environment variable. | ||
# | ||
config.enable_analytics = proc { Rails.application.config.dfe_analytics } | ||
|
||
config.user_identifier = proc { |user| user&.sub } | ||
|
||
# The environment we’re running in. This value will be attached | ||
# to all events we send to BigQuery. | ||
# | ||
# config.environment = ENV.fetch('RAILS_ENV', 'development') | ||
|
||
config.bigquery_maintenance_window = "08-09-2024 18:00..08-09-2024 19:00" | ||
|
||
config.azure_federated_auth = ENV.include? "GOOGLE_CLOUD_CREDENTIALS" | ||
end |