-
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.
* leave the default analytics settings until the customer has updated the tenant settings
- Loading branch information
Showing
2 changed files
with
33 additions
and
16 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 |
---|---|---|
|
@@ -15,6 +15,13 @@ module AccountSettings | |
end | ||
|
||
setting :allow_signup, type: 'boolean', default: true | ||
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 :bulkrax_validations, type: 'boolean', disabled: true | ||
setting :cache_api, type: 'boolean', default: false | ||
setting :contact_email, type: 'string', default: '[email protected]' | ||
|
@@ -29,13 +36,6 @@ 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]' | ||
|
@@ -192,6 +192,23 @@ def reload_library_config | |
end | ||
|
||
def reload_analytics | ||
# fall back to the default values if they aren't set in the tenant | ||
unless analytics_id.present? && | ||
analytics_oauth_app_name.present? && | ||
analytics_oauth_app_version.present? && | ||
analytics_oauth_private_key_secret.present? && | ||
analytics_oauth_client_email.present? && | ||
(analytics_oauth_private_key_value.present? || analytics_oauth_private_key_path.present?) | ||
|
||
config = Hyrax::Analytics::Config.load_from_yaml | ||
analytics_id ||= config.analytics_id | ||
analytics_oauth_app_name ||= config.app_name | ||
analytics_oauth_app_version ||= config.app_version | ||
analytics_oauth_private_key_secret ||= config.privkey_secret | ||
analytics_oauth_private_key_value ||= config.privkey_value | ||
analytics_oauth_client_email ||= config.client_email | ||
end | ||
|
||
# require the analytics to be set per tenant | ||
Hyrax::Analytics.config.analytics_id = analytics_id | ||
Hyrax::Analytics.config.app_name = analytics_oauth_app_name | ||
|
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,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['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'] %> | ||
# # OR privkey_path: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_PATH'] %> | ||
# privkey_secret: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_SECRET'] %> | ||
# client_email: <%= ENV['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'] %> | ||
# OR privkey_path: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_PATH'] %> | ||
privkey_secret: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_SECRET'] %> | ||
client_email: <%= ENV['GOOGLE_OAUTH_CLIENT_EMAIL'] %> |