-
Notifications
You must be signed in to change notification settings - Fork 0
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 analytics per tenant #479
Merged
Merged
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a61a377
add ability to determine config.analytics per tenant
alishaevn 86227dd
add the private key value to the admin settings
alishaevn 933256a
hyrax analytics are off by default.
alishaevn 52def57
Merge branch 'main' into 408-analytics-per-tenant
alishaevn 266a45a
adjust terminology to show that other analytics apps can be used besi…
alishaevn 295a947
readme cleanup. add extra hints to settings page. disable Style/EvalW…
alishaevn a887a57
update other references to google env variables and hyrax analytics i…
alishaevn a011c9a
Merge branch 'main' into 408-analytics-per-tenant
alishaevn b4222d4
Update app/services/hyrax/analytics/google.rb
alishaevn 54a7b25
Update app/services/hyrax/analytics/google.rb
alishaevn 2f9af95
too overzealous :sweat-smile:
alishaevn 92ec8cc
putting these back. they need to be removed in #482 instead
alishaevn aef3953
rubocop fixes
alishaevn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
# All settings have a presedence order as follows | ||
# All settings have a precedence order as follows | ||
# Per Tenant Setting > ENV['HYKU_SETTING_NAME'] > ENV['HYRAX_SETTING_NAME'] > default | ||
|
||
module AccountSettings | ||
|
@@ -29,6 +29,13 @@ module AccountSettings | |
setting :google_scholarly_work_types, type: 'array', disabled: true | ||
setting :geonames_username, type: 'string', default: '' | ||
setting :gtm_id, type: 'string' | ||
setting :analytics_id, type: 'string' | ||
setting :analytics_oauth_app_name, type: 'string' | ||
setting :analytics_oauth_app_version, type: 'string' | ||
setting :analytics_oauth_private_key_secret, type: 'string' | ||
setting :analytics_oauth_private_key_path, type: 'string' | ||
setting :analytics_oauth_private_key_value, type: 'string' | ||
setting :analytics_oauth_client_email, type: 'string' | ||
setting :locale_name, type: 'string', disabled: true | ||
setting :monthly_email_list, type: 'array', disabled: true | ||
setting :oai_admin_email, type: 'string', default: '[email protected]' | ||
|
@@ -58,7 +65,7 @@ module AccountSettings | |
class_methods do | ||
def setting(name, args) | ||
known_type = ['array', 'boolean', 'hash', 'string'].include?(args[:type]) | ||
raise "Setting type #{args[:type]} is not supported. Can not laod." unless known_type | ||
raise "Setting type #{args[:type]} is not supported. Can not load." unless known_type | ||
|
||
send("#{args[:type]}_settings") << name | ||
all_settings[name] = args | ||
|
@@ -156,6 +163,8 @@ def reload_library_config | |
config.uploader[:maxFileSize] = file_size_limit | ||
end | ||
|
||
reload_analytics | ||
|
||
Devise.mailer_sender = contact_email | ||
|
||
if s3_bucket.present? | ||
|
@@ -181,4 +190,18 @@ def reload_library_config | |
ActionMailer::Base.default_url_options ||= {} | ||
ActionMailer::Base.default_url_options[:protocol] = 'https' | ||
end | ||
|
||
def reload_analytics | ||
# require the analytics to be set per tenant | ||
Hyrax::Analytics.config.analytics_id = analytics_id | ||
Hyrax::Analytics.config.app_name = analytics_oauth_app_name | ||
Hyrax::Analytics.config.app_version = analytics_oauth_app_version | ||
Hyrax::Analytics.config.privkey_secret = analytics_oauth_private_key_secret | ||
Hyrax::Analytics.config.privkey_path = analytics_oauth_private_key_path | ||
Hyrax::Analytics.config.privkey_value = analytics_oauth_private_key_value | ||
Hyrax::Analytics.config.client_email = analytics_oauth_client_email | ||
|
||
# only show analytics partials if analytics are set on the tenant | ||
Hyrax.config.analytics = Hyrax::Analytics.config.valid? | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analytics are determined on a per tenant basis, so these are no longer necessary.