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
Show file tree
Hide file tree
Changes from all commits
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
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
4 changes: 0 additions & 4 deletions bin/web
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
#!/usr/local/bin/ruby
if ENV['GOOGLE_OAUTH_PRIVATE_KEY_VALUE'] && !ENV['GOOGLE_OAUTH_PRIVATE_KEY_VALUE'].empty?
%x{echo "$GOOGLE_OAUTH_PRIVATE_KEY_VALUE" | base64 -d > prod-cred.p12}
end

exec "bundle exec puma -v -b tcp://0.0.0.0:3000"
4 changes: 0 additions & 4 deletions bin/worker
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/usr/local/bin/ruby
if ENV['GOOGLE_OAUTH_PRIVATE_KEY_VALUE'] && !ENV['GOOGLE_OAUTH_PRIVATE_KEY_VALUE'].empty?
%x{echo "$GOOGLE_OAUTH_PRIVATE_KEY_VALUE" | base64 -d > prod-cred.p12}
end

if ENV['DB_URL'] && !ENV['DB_URL'].empty?
ENV['DB_URL'] = ENV['DB_URL'].gsub('pool=5', 'pool=30')
else
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'] %>
16 changes: 0 additions & 16 deletions ops/production-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,6 @@ extraEnvVars: &envVars
value: http://palsfcrepo:8080/rest
- name: GOOGLE_FONTS_KEY
value: $GOOGLE_FONTS_KEY
- name: GOOGLE_ANALYTICS_ID
value: $GOOGLE_ANALYTICS_ID
- name: GOOGLE_OAUTH_APP_NAME
value: palni-palci-production
- name: GOOGLE_OAUTH_APP_VERSION
value: '1.0'
- name: GOOGLE_OAUTH_PRIVATE_KEY_SECRET
value: $GOOGLE_OAUTH_PRIVATE_KEY_SECRET
- name: GOOGLE_OAUTH_PRIVATE_KEY_PATH
value: prod-cred.p12
- name: GOOGLE_OAUTH_PRIVATE_KEY_VALUE
value: $GOOGLE_OAUTH_PRIVATE_KEY_VALUE
- name: GOOGLE_OAUTH_CLIENT_EMAIL
value: [email protected]
- name: HYKU_ACTIVE_JOB_QUEUE_URL
value: sidekiq
- name: HYKU_ADMIN_HOST
Expand All @@ -120,8 +106,6 @@ extraEnvVars: &envVars
value: hykucommons.org
- name: HYRAX_ACTIVE_JOB_QUEUE
value: sidekiq
- name: HYRAX_ANALYTICS
value: 'true'
- name: HYRAX_FITS_PATH
value: /app/fits/fits.sh
- name: INITIAL_ADMIN_EMAIL
Expand Down