-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add ability to determine config.analytics per tenant co-authored-by: rob <[email protected]> * add the private key value to the admin settings * hyrax analytics are off by default. analytics will be programmatically determined by setting the appropriate values in the admin settings. * adjust terminology to show that other analytics apps can be used besides google * readme cleanup. add extra hints to settings page. disable Style/EvalWithLocation rubocop setting for google.rb method * update other references to google env variables and hyrax analytics implementations * Update app/services/hyrax/analytics/google.rb Co-authored-by: Rob Kaufman <[email protected]> * Update app/services/hyrax/analytics/google.rb Co-authored-by: Rob Kaufman <[email protected]> * too overzealous :sweat-smile: * putting these back. they need to be removed in #482 instead * rubocop fixes --------- Co-authored-by: Rob Kaufman <[email protected]>
- Loading branch information
1 parent
04b2255
commit 80d1aaf
Showing
8 changed files
with
292 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,16 +47,5 @@ HYKU_MULTITENANT=true | |
# allow registered users to create curation concerns (Works, Collections, and FileSets) | ||
HYKU_RESTRICT_CREATE_AND_DESTROY_PERMISSIONS=true | ||
|
||
##START## Enable Google Analytics | ||
# Uncomment to enable and configure Google Analytics, see README for instructions. | ||
HYRAX_ANALYTICS=true | ||
GOOGLE_ANALYTICS_ID=see-1pass | ||
GOOGLE_OAUTH_APP_NAME=palni-palci-demo | ||
GOOGLE_OAUTH_APP_VERSION=1.0 | ||
GOOGLE_OAUTH_PRIVATE_KEY_SECRET=notasecret | ||
GOOGLE_OAUTH_PRIVATE_KEY_PATH=cred.p12 | ||
GOOGLE_OAUTH_CLIENT_EMAIL=[email protected] | ||
|
||
# AND comment this out | ||
# HYRAX_ANALYTICS=false | ||
##END## Enable Google Analytics | ||
# Refer to the README for how to configure analytics | ||
HYRAX_ANALYTICS=false |
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.