Skip to content

Commit

Permalink
remove the temporary code that was added until the production environ…
Browse files Browse the repository at this point in the history
…ment was ready to move to per tenant analytics

ref:
- #579
- #580
  • Loading branch information
alishaevn committed Jun 23, 2023
1 parent dc198fd commit 7bbe872
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 29 deletions.
20 changes: 0 additions & 20 deletions app/models/concerns/account_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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'] %>

0 comments on commit 7bbe872

Please sign in to comment.