Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

408/569 disable-analytics-defaults-prod #487

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove the temporary code that was added until the production environ…
…ment was ready to move to per tenant analytics

ref:
- #579
- #580
alishaevn committed Jun 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7bbe872b479ecd0c7e6f24f6eb2788f7ae6fa05d
20 changes: 0 additions & 20 deletions app/models/concerns/account_settings.rb
Original file line number Diff line number Diff line change
@@ -193,26 +193,6 @@ def reload_library_config

def reload_analytics
# rubocop:disable Style/RedundantSelf
if Rails.env.production?
# fall back to the default values if they aren't set in the tenant
unless self.google_analytics_id.present? &&
self.google_oauth_app_name.present? &&
self.google_oauth_app_version.present? &&
(self.google_oauth_private_key_value.present? || self.google_oauth_private_key_path.present?) &&
self.google_oauth_private_key_secret.present? &&
self.google_oauth_client_email.present?

config = Hyrax::Analytics::Config.load_from_yaml
self.google_analytics_id = self.google_analytics_id.presence || config.analytics_id
self.google_oauth_app_name = self.google_oauth_app_name.presence || config.app_name
self.google_oauth_app_version = self.google_oauth_app_version.presence || config.app_version
self.google_oauth_private_key_value = self.google_oauth_private_key_value.presence || config.privkey_value
self.google_oauth_private_key_path = self.google_oauth_private_key_path.presence || config.privkey_path
self.google_oauth_private_key_secret = self.google_oauth_private_key_secret.presence || config.privkey_secret
self.google_oauth_client_email = self.google_oauth_client_email.presence || config.client_email
end
end

# require the analytics to be set per tenant
Hyrax::Analytics.config.analytics_id = self.google_analytics_id
Hyrax::Analytics.config.app_name = self.google_oauth_app_name
18 changes: 9 additions & 9 deletions config/analytics.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#
# To integrate your app with Google Analytics, uncomment the lines below and add your API key information.
#
analytics:
google:
analytics_id: <%= ENV.fetch('GOOGLE_ANALYTICS_ID', '') %>
app_name: <%= ENV.fetch('GOOGLE_OAUTH_APP_NAME', '') %>
app_version: <%= ENV.fetch('GOOGLE_OAUTH_APP_VERSION', '') %>
privkey_value: <%= ENV.fetch('GOOGLE_OAUTH_PRIVATE_KEY_VALUE', '') %>
privkey_path: <%= ENV.fetch('GOOGLE_OAUTH_PRIVATE_KEY_PATH', '') %>
privkey_secret: <%= ENV.fetch('GOOGLE_OAUTH_PRIVATE_KEY_SECRET', '') %>
client_email: <%= ENV.fetch('GOOGLE_OAUTH_CLIENT_EMAIL', '') %>
# analytics:
# google:
# analytics_id: <%= ENV['GOOGLE_ANALYTICS_ID'] %>
# app_name: <%= ENV['GOOGLE_OAUTH_APP_NAME'] %>
# app_version: <%= ENV['GOOGLE_OAUTH_APP_VERSION'] %>
# privkey_value: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_VALUE'] %>
# privkey_path: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_PATH'] %>
# privkey_secret: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_SECRET'] %>
# client_email: <%= ENV['GOOGLE_OAUTH_CLIENT_EMAIL'] %>