Class: Hyrax::Configuration
- Inherits:
-
Object
- Object
- Hyrax::Configuration
- Includes:
- Callbacks
- Defined in:
- lib/hyrax/configuration.rb
Overview
Handles configuration for the Hyrax engine.
This class provides a series of accessors for setting and retrieving global engine options. For convenient reference, options are grouped into the following functional areas:
-
Groups
-
Identifiers
-
IIIF
-
Local Storage
-
System Dependencies
-
Theme
-
Valkyrie
Groups
Hyrax has special handling for three groups: “admin”, “registered”, and “public”.
These settings support using custom names for these functional groups in object ACLs.
Identifiers
IIIF
Objects in Hyrax serve out IIIF manifests. These configuration options toggle server availability, allow customization of image and info URL generation, and provide other hooks for custom IIIF behavior.
Local Storage
Hyrax applications need local disk access to store working copies of files for a variety of purposes. Some of these storage paths need to be available all application processes. These options control the paths to use for each type of file.
System Dependiencies
Theme
Options related to the overall appearance of Hyrax.
Valkyrie
Experimental: Options for toggling Hyrax’s experimental “Wings” valkyrie adapter and configuring valkyrie.
Analytics collapse
-
#analytic_start_date ⇒ Object
Returns the value of attribute analytic_start_date.
-
#analytics ⇒ Object
Returns the value of attribute analytics.
- #analytics_provider ⇒ Object
- #analytics_start_date ⇒ Object
Groups collapse
- #admin_user_group_name ⇒ String
- #public_user_group_name ⇒ String
- #registered_user_group_name ⇒ String
Identifier Minting collapse
-
#enable_noids ⇒ Object
writeonly
Sets the attribute enable_noids.
- #minter_statefile ⇒ Object
- #noid_minter_class ⇒ Object
- #noid_template ⇒ Object
IIIF collapse
-
#iiif_image_compliance_level_uri ⇒ String
URL that indicates your IIIF image server compliance level.
-
#iiif_image_server ⇒ Object
writeonly
Sets the attribute iiif_image_server.
-
#iiif_image_size_default ⇒ #String
IIIF image size default.
-
#iiif_image_url_builder ⇒ #call
URL that resolves to an image provided by a IIIF image server.
-
#iiif_info_url_builder ⇒ #call
URL that resolves to an info.json file provided by a IIIF image server.
-
#iiif_manifest_cache_duration ⇒ Integer
Duration in which we should cache the generated IIIF manifest.
-
#iiif_metadata_fields ⇒ #Array
IIIF metadata - fields to display in the metadata section.
-
#rendering_predicate ⇒ RDF::URI
Set predicate for rendering to dc:hasFormat as defined in IIIF Presentation API context: iiif.io/api/presentation/2/context.json.
Local Storage collapse
- #bagit_dir ⇒ Object
- #branding_path ⇒ Object
- #cache_path ⇒ Object
- #derivatives_path ⇒ Object
- #upload_path ⇒ Object
- #working_path ⇒ Object
System Dependencies collapse
- #enable_ffmpeg ⇒ Object
- #ffmpeg_path ⇒ Object
- #fits_message_length ⇒ Object
- #fits_path ⇒ Object
- #import_export_jar_file_path ⇒ Object
- #virus_scanner ⇒ Object
Theme collapse
- #banner_image ⇒ Object
- #disable_wings ⇒ Boolean
-
#display_media_download_link ⇒ Object
writeonly
Sets the attribute display_media_download_link.
Valkyrie collapse
-
#query_index_from_valkyrie ⇒ Boolean
Whether to use the experimental valkyrie index.
Instance Attribute Summary collapse
-
#active_deposit_agreement_acceptance ⇒ Object
writeonly
Sets the attribute active_deposit_agreement_acceptance.
- #activity_to_show_default_seconds_since_now ⇒ Object
-
#admin_set_model ⇒ #constantize
A string representation of the admin set model.
- #admin_set_predicate ⇒ Object
-
#arkivo_api ⇒ Object
writeonly
Sets the attribute arkivo_api.
- #audit_user_key ⇒ Object
- #batch_user_key ⇒ Object
-
#browse_everything ⇒ Object
writeonly
Sets the attribute browse_everything.
- #characterization_proxy ⇒ Object
-
#characterization_runner ⇒ Object
Override characterization runner.
-
#characterization_service ⇒ #run
@ see Hyrax::Characterization::ValkyrieCharacterizationService.
-
#citations ⇒ Object
writeonly
Sets the attribute citations.
-
#collection_model ⇒ #constantize
A string representation of the collection model.
- #collection_type_index_field ⇒ Object
- #contact_email ⇒ Object
-
#default_active_workflow_name ⇒ String
When an admin set is created, we need to activate a workflow.
-
#display_microdata ⇒ Object
writeonly
Sets the attribute display_microdata.
-
#display_share_button_when_not_logged_in ⇒ Object
writeonly
Should a button with “Share my work” show on the front page to users who are not logged in?.
-
#enable_local_ingest ⇒ Object
Returns the value of attribute enable_local_ingest.
-
#extract_full_text ⇒ Object
writeonly
Sets the attribute extract_full_text.
- #feature_config_path ⇒ Object
- #fixity_service ⇒ Object
- #id_field ⇒ Object
- #identifier_registrars ⇒ Object
- #index_field_mapper ⇒ Object
- #ingest_queue_name ⇒ Object
- #libreoffice_path ⇒ Object
- #license_service_class ⇒ Object
- #lock_retry_count ⇒ Object
- #lock_retry_delay ⇒ Object
- #lock_time_to_live ⇒ Object
- #max_days_between_fixity_checks ⇒ Object
- #max_notifications_for_dashboard ⇒ Object
- #microdata_default_type ⇒ Object
-
#nested_relationship_reindexer ⇒ Object
Returns the value of attribute nested_relationship_reindexer.
- #owner_permission_levels ⇒ Object
- #permission_levels ⇒ Object
- #permission_options ⇒ Object
- #persistent_hostpath ⇒ Object
- #publisher ⇒ Object
- #range_for_number_of_results_to_display_per_page ⇒ Array<Integer>
-
#realtime_notifications ⇒ Object
writeonly
rubocop:disable Layout/LineLength.
- #redis_namespace ⇒ Object
- #registered_ingest_dirs ⇒ Object
- #resource_id_to_uri_transformer ⇒ Object
- #rights_statement_service_class ⇒ Object
- #show_work_item_rows ⇒ Object
- #solr_select_path ⇒ Object
- #subject_prefix ⇒ Object
- #system_user_key ⇒ Object
-
#temp_file_base ⇒ Object
Returns the value of attribute temp_file_base.
- #translate_id_to_uri ⇒ Object
- #translate_uri_to_id ⇒ Object
- #uploader ⇒ Object
-
#work_requires_files ⇒ Object
writeonly
Sets the attribute work_requires_files.
Analytics collapse
- #analytics? ⇒ Boolean
-
#google_analytics_id ⇒ Object
(also: #google_analytics_id?)
deprecated
Deprecated.
use analytics_id from config/analytics.yml instead
-
#google_analytics_id=(value) ⇒ Object
deprecated
Deprecated.
use analytics_id from config/analytics.yml instead
Identifier Minting collapse
IIIF collapse
-
#iiif_image_server? ⇒ Boolean
Enable IIIF image service.
Theme collapse
Valkyrie collapse
- #branding_storage_adapter ⇒ Valkyrie::StorageAdapter
- #branding_storage_adapter=(adapter) ⇒ Object
- #derivatives_storage_adapter ⇒ Valkyrie::StorageAdapter
- #derivatives_storage_adapter=(adapter) ⇒ Object
-
#index_adapter ⇒ #save, ...
An indexing adapter.
- #index_adapter=(adapter) ⇒ Object
-
#use_valkyrie? ⇒ Boolean
Whether to use experimental valkyrie storage features.
Instance Method Summary collapse
- #active_deposit_agreement_acceptance? ⇒ Boolean
-
#admin_set_class ⇒ Class
The configured admin set model class.
- #arkivo_api? ⇒ Boolean
- #browse_everything? ⇒ Boolean
- #citations? ⇒ Boolean
-
#collection_class ⇒ Class
The configured collection model class.
-
#curation_concerns ⇒ Array<Class>
The registered curation concerns.
-
#default_admin_set ⇒ Hyrax::AdministrativeSet
The default admin set.
-
#default_admin_set_id ⇒ String
The default admin set id.
- #default_nested_relationship_reindexer ⇒ Object
- #display_microdata? ⇒ Boolean
- #display_share_button_when_not_logged_in? ⇒ Boolean
- #extract_full_text? ⇒ Boolean
-
#geonames_username=(username) ⇒ Object
rubocop:enable Layout/LineLength.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #realtime_notifications? ⇒ Boolean
-
#register_curation_concern(*curation_concern_types) ⇒ Object
Registers the given curation concern model in the configuration.
-
#register_roles {|Hyrax::RoleRegistry| ... } ⇒ TrueClass
Exposes a means to register application critical roles.
-
#registered_curation_concern_types ⇒ Array<String>
The normalization done by this method must occur after the initialization process so it can take advantage of irregular inflections from config/initializers/inflections.rb.
-
#reset_default_admin_set ⇒ Object
If the default admin set is changed, call reset.
- #use_solr_graph_for_collection_nesting ⇒ Object
- #whitelisted_ingest_dirs ⇒ Object deprecated Deprecated.
- #whitelisted_ingest_dirs=(input) ⇒ Object deprecated Deprecated.
- #work_requires_files? ⇒ Boolean
Methods included from Callbacks
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
64 65 66 67 68 69 |
# File 'lib/hyrax/configuration.rb', line 64 def initialize @registered_concerns = [] @role_registry = Hyrax::RoleRegistry.new @default_active_workflow_name = DEFAULT_ACTIVE_WORKFLOW_NAME @nested_relationship_reindexer = default_nested_relationship_reindexer end |
Instance Attribute Details
#active_deposit_agreement_acceptance=(value) ⇒ Object (writeonly)
Sets the attribute active_deposit_agreement_acceptance
687 688 689 |
# File 'lib/hyrax/configuration.rb', line 687 def active_deposit_agreement_acceptance=(value) @active_deposit_agreement_acceptance = value end |
#activity_to_show_default_seconds_since_now ⇒ Object
658 659 660 |
# File 'lib/hyrax/configuration.rb', line 658 def activity_to_show_default_seconds_since_now @activity_to_show_default_seconds_since_now ||= 24 * 60 * 60 end |
#admin_set_model ⇒ #constantize
Returns a string representation of the admin set model.
750 751 752 |
# File 'lib/hyrax/configuration.rb', line 750 def admin_set_model @admin_set_model ||= 'AdminSet' end |
#admin_set_predicate ⇒ Object
694 695 696 |
# File 'lib/hyrax/configuration.rb', line 694 def admin_set_predicate @admin_set_predicate ||= ::RDF::Vocab::DC.isPartOf end |
#admin_user_group_name ⇒ String
172 173 174 |
# File 'lib/hyrax/configuration.rb', line 172 def admin_user_group_name @admin_user_group_name ||= 'admin' end |
#analytic_start_date ⇒ Object
Returns the value of attribute analytic_start_date.
138 139 140 |
# File 'lib/hyrax/configuration.rb', line 138 def analytic_start_date @analytic_start_date end |
#analytics ⇒ Object
Returns the value of attribute analytics.
109 110 111 |
# File 'lib/hyrax/configuration.rb', line 109 def analytics @analytics end |
#analytics_provider ⇒ Object
118 119 120 121 |
# File 'lib/hyrax/configuration.rb', line 118 def analytics_provider @analytics_provider ||= ENV.fetch('HYRAX_ANALYTICS_PROVIDER', 'google') end |
#analytics_start_date ⇒ Object
131 132 133 134 |
# File 'lib/hyrax/configuration.rb', line 131 def analytics_start_date @analytics_start_date ||= ENV.fetch('ANALYTICS_START_DATE', Time.zone.today - 1.year) end |
#arkivo_api=(value) ⇒ Object (writeonly)
Sets the attribute arkivo_api
662 663 664 |
# File 'lib/hyrax/configuration.rb', line 662 def arkivo_api=(value) @arkivo_api = value end |
#audit_user_key ⇒ Object
723 724 725 |
# File 'lib/hyrax/configuration.rb', line 723 def audit_user_key @audit_user_key ||= '[email protected]' end |
#bagit_dir ⇒ Object
308 309 310 |
# File 'lib/hyrax/configuration.rb', line 308 def bagit_dir @bagit_dir ||= "tmp/descriptions" end |
#banner_image ⇒ Object
395 396 397 398 |
# File 'lib/hyrax/configuration.rb', line 395 def # This image can be used for free and without attribution. See here for source and license: https://github.com/samvera/hyrax/issues/1551#issuecomment-326624909 @banner_image ||= 'https://user-images.githubusercontent.com/101482/29949206-ffa60d2c-8e67-11e7-988d-4910b8787d56.jpg' end |
#batch_user_key ⇒ Object
718 719 720 |
# File 'lib/hyrax/configuration.rb', line 718 def batch_user_key @batch_user_key ||= '[email protected]' end |
#branding_path ⇒ Object
338 339 340 |
# File 'lib/hyrax/configuration.rb', line 338 def branding_path @branding_path ||= ENV.fetch('HYRAX_BRANDING_PATH', Rails.root.join('public', 'branding')) end |
#browse_everything=(value) ⇒ Object (writeonly)
Sets the attribute browse_everything
642 643 644 |
# File 'lib/hyrax/configuration.rb', line 642 def browse_everything=(value) @browse_everything = value end |
#cache_path ⇒ Object
332 333 334 |
# File 'lib/hyrax/configuration.rb', line 332 def cache_path @cache_path ||= ->() { ENV.fetch('HYRAX_CACHE_PATH') { Rails.root.join('tmp', 'cache') } } end |
#characterization_proxy ⇒ Object
516 517 518 |
# File 'lib/hyrax/configuration.rb', line 516 def characterization_proxy @characterization_proxy ||= :original_file end |
#characterization_runner ⇒ Object
Override characterization runner
498 499 500 |
# File 'lib/hyrax/configuration.rb', line 498 def characterization_runner @characterization_runner end |
#characterization_service ⇒ #run
@ see Hyrax::Characterization::ValkyrieCharacterizationService
505 |
# File 'lib/hyrax/configuration.rb', line 505 attr_writer :characterization_service |
#citations=(value) ⇒ Object (writeonly)
Sets the attribute citations
647 648 649 |
# File 'lib/hyrax/configuration.rb', line 647 def citations=(value) @citations = value end |
#collection_model ⇒ #constantize
Returns a string representation of the collection model.
736 737 738 |
# File 'lib/hyrax/configuration.rb', line 736 def collection_model @collection_model ||= '::Collection' end |
#collection_type_index_field ⇒ Object
728 729 730 |
# File 'lib/hyrax/configuration.rb', line 728 def collection_type_index_field @collection_type_index_field ||= 'collection_type_gid_ssim' end |
#contact_email ⇒ Object
853 854 855 |
# File 'lib/hyrax/configuration.rb', line 853 def contact_email @contact_email ||= "[email protected]" end |
#default_active_workflow_name ⇒ String
The active workflow for an admin set can be changed at a later point.
Changing this value after other AdminSet(s) are created does not alter the already created AdminSet(s)
When an admin set is created, we need to activate a workflow. The :default_active_workflow_name is the name of the workflow we will activate.
83 84 85 |
# File 'lib/hyrax/configuration.rb', line 83 def default_active_workflow_name @default_active_workflow_name end |
#derivatives_path ⇒ Object
314 315 316 |
# File 'lib/hyrax/configuration.rb', line 314 def derivatives_path @derivatives_path ||= ENV.fetch('HYRAX_DERIVATIVES_PATH', Rails.root.join('tmp', 'derivatives')) end |
#disable_wings ⇒ Boolean
402 403 404 405 |
# File 'lib/hyrax/configuration.rb', line 402 def disable_wings return @disable_wings unless @disable_wings.nil? ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_SKIP_WINGS', false)) end |
#display_media_download_link=(value) ⇒ Object (writeonly)
Sets the attribute display_media_download_link
408 409 410 |
# File 'lib/hyrax/configuration.rb', line 408 def display_media_download_link=(value) @display_media_download_link = value end |
#display_microdata=(value) ⇒ Object (writeonly)
Sets the attribute display_microdata
476 477 478 |
# File 'lib/hyrax/configuration.rb', line 476 def display_microdata=(value) @display_microdata = value end |
#display_share_button_when_not_logged_in=(value) ⇒ Object (writeonly)
Should a button with “Share my work” show on the front page to users who are not logged in?
792 793 794 |
# File 'lib/hyrax/configuration.rb', line 792 def (value) @display_share_button_when_not_logged_in = value end |
#enable_ffmpeg ⇒ Object
346 347 348 349 |
# File 'lib/hyrax/configuration.rb', line 346 def enable_ffmpeg return @enable_ffmpeg unless @enable_ffmpeg.nil? @enable_ffmpeg = false end |
#enable_local_ingest ⇒ Object
Returns the value of attribute enable_local_ingest.
474 475 476 |
# File 'lib/hyrax/configuration.rb', line 474 def enable_local_ingest @enable_local_ingest end |
#enable_noids=(value) ⇒ Object (writeonly)
Sets the attribute enable_noids
193 194 195 |
# File 'lib/hyrax/configuration.rb', line 193 def enable_noids=(value) @enable_noids = value end |
#extract_full_text=(value) ⇒ Object (writeonly)
Sets the attribute extract_full_text
862 863 864 |
# File 'lib/hyrax/configuration.rb', line 862 def extract_full_text=(value) @extract_full_text = value end |
#feature_config_path ⇒ Object
470 471 472 |
# File 'lib/hyrax/configuration.rb', line 470 def feature_config_path @feature_config_path ||= Rails.root.join('config', 'features.yml') end |
#ffmpeg_path ⇒ Object
we recommend setting the FFMPEG path with the ‘HYRAX_FFMPEG_PATH` environment variable
355 356 357 |
# File 'lib/hyrax/configuration.rb', line 355 def ffmpeg_path @ffmpeg_path ||= ENV.fetch('HYRAX_FFMPEG_PATH', 'ffmpeg') end |
#fits_message_length ⇒ Object
368 369 370 |
# File 'lib/hyrax/configuration.rb', line 368 def @fits_message_length ||= 5 end |
#fits_path ⇒ Object
we recommend setting the FITS path with the ‘HYRAX_FITS_PATH` environment variable
363 364 365 |
# File 'lib/hyrax/configuration.rb', line 363 def fits_path @fits_path ||= ENV.fetch('HYRAX_FITS_PATH', 'fits.sh') end |
#fixity_service ⇒ Object
488 489 490 |
# File 'lib/hyrax/configuration.rb', line 488 def fixity_service @fixity_service ||= Hyrax::Fixity::ActiveFedoraFixityService end |
#id_field ⇒ Object
782 783 784 |
# File 'lib/hyrax/configuration.rb', line 782 def id_field @id_field || index_field_mapper.id_field end |
#identifier_registrars ⇒ Object
897 898 899 |
# File 'lib/hyrax/configuration.rb', line 897 def identifier_registrars @identifier_registrars ||= {} end |
#iiif_image_compliance_level_uri ⇒ String
URL that indicates your IIIF image server compliance level
264 265 266 |
# File 'lib/hyrax/configuration.rb', line 264 def iiif_image_compliance_level_uri @iiif_image_compliance_level_uri ||= 'http://iiif.io/api/image/2/level2.json' end |
#iiif_image_server=(value) ⇒ Object (writeonly)
Sets the attribute iiif_image_server
218 219 220 |
# File 'lib/hyrax/configuration.rb', line 218 def iiif_image_server=(value) @iiif_image_server = value end |
#iiif_image_size_default ⇒ #String
IIIF image size default
271 272 273 |
# File 'lib/hyrax/configuration.rb', line 271 def iiif_image_size_default @iiif_image_size_default ||= '600,' end |
#iiif_image_url_builder ⇒ #call
URL that resolves to an image provided by a IIIF image server
250 251 252 |
# File 'lib/hyrax/configuration.rb', line 250 def iiif_image_url_builder @iiif_image_url_builder ||= ->(file_id, base_url, _size, _format) { "#{base_url}/downloads/#{file_id.split('/').first}" } end |
#iiif_info_url_builder ⇒ #call
URL that resolves to an info.json file provided by a IIIF image server
257 258 259 |
# File 'lib/hyrax/configuration.rb', line 257 def iiif_info_url_builder @iiif_info_url_builder ||= ->(_file_id, _base_url) { '' } end |
#iiif_manifest_cache_duration ⇒ Integer
Duration in which we should cache the generated IIIF manifest. Default is 30 days (in seconds).
287 288 289 |
# File 'lib/hyrax/configuration.rb', line 287 def iiif_manifest_cache_duration @iiif_manifest_cache_duration ||= 30.days.to_i end |
#iiif_metadata_fields ⇒ #Array
IIIF metadata - fields to display in the metadata section
278 279 280 |
# File 'lib/hyrax/configuration.rb', line 278 def @iiif_metadata_fields ||= Hyrax::Forms::WorkForm.required_fields end |
#import_export_jar_file_path ⇒ Object
375 376 377 |
# File 'lib/hyrax/configuration.rb', line 375 def import_export_jar_file_path @import_export_jar_file_path ||= "tmp/fcrepo-import-export.jar" end |
#index_field_mapper ⇒ Object
787 788 789 |
# File 'lib/hyrax/configuration.rb', line 787 def index_field_mapper @index_field_mapper ||= ActiveFedora.index_field_mapper end |
#ingest_queue_name ⇒ Object
545 546 547 |
# File 'lib/hyrax/configuration.rb', line 545 def ingest_queue_name @ingest_queue_name ||= :default end |
#libreoffice_path ⇒ Object
638 639 640 |
# File 'lib/hyrax/configuration.rb', line 638 def libreoffice_path @libreoffice_path ||= "soffice" end |
#license_service_class ⇒ Object
612 613 614 |
# File 'lib/hyrax/configuration.rb', line 612 def license_service_class @license_service_class ||= Hyrax::LicenseService end |
#lock_retry_count ⇒ Object
524 525 526 |
# File 'lib/hyrax/configuration.rb', line 524 def lock_retry_count @lock_retry_count ||= 600 # Up to 2 minutes of trying at intervals up to 200ms end |
#lock_retry_delay ⇒ Object
538 539 540 |
# File 'lib/hyrax/configuration.rb', line 538 def lock_retry_delay @lock_retry_delay ||= 200 # milliseconds end |
#lock_time_to_live ⇒ Object
531 532 533 |
# File 'lib/hyrax/configuration.rb', line 531 def lock_time_to_live @lock_time_to_live ||= 60_000 # milliseconds end |
#max_days_between_fixity_checks ⇒ Object
493 494 495 |
# File 'lib/hyrax/configuration.rb', line 493 def max_days_between_fixity_checks @max_days_between_fixity_checks ||= 7 end |
#max_notifications_for_dashboard ⇒ Object
653 654 655 |
# File 'lib/hyrax/configuration.rb', line 653 def max_notifications_for_dashboard @max_notifications_for_dashboard ||= 5 end |
#microdata_default_type ⇒ Object
483 484 485 |
# File 'lib/hyrax/configuration.rb', line 483 def microdata_default_type @microdata_default_type ||= 'http://schema.org/CreativeWork' end |
#minter_statefile ⇒ Object
210 211 212 |
# File 'lib/hyrax/configuration.rb', line 210 def minter_statefile @minter_statefile ||= '/tmp/minter-state' end |
#nested_relationship_reindexer ⇒ Object
Returns the value of attribute nested_relationship_reindexer.
882 883 884 |
# File 'lib/hyrax/configuration.rb', line 882 def nested_relationship_reindexer @nested_relationship_reindexer end |
#noid_minter_class ⇒ Object
205 206 207 |
# File 'lib/hyrax/configuration.rb', line 205 def noid_minter_class @noid_minter_class ||= ::Noid::Rails::Minter::Db end |
#noid_template ⇒ Object
200 201 202 |
# File 'lib/hyrax/configuration.rb', line 200 def noid_template @noid_template ||= '.reeddeeddk' end |
#owner_permission_levels ⇒ Object
805 806 807 |
# File 'lib/hyrax/configuration.rb', line 805 def @owner_permission_levels ||= { I18n.t('hyrax.permission_levels.owner.edit') => "edit" } end |
#permission_levels ⇒ Object
799 800 801 802 |
# File 'lib/hyrax/configuration.rb', line 799 def @permission_levels ||= { I18n.t('hyrax.permission_levels.read') => "read", I18n.t('hyrax.permission_levels.edit') => "edit" } end |
#permission_options ⇒ Object
810 811 812 813 814 |
# File 'lib/hyrax/configuration.rb', line 810 def @permission_options ||= { I18n.t('hyrax.permission_levels.options.none') => "none", I18n.t('hyrax.permission_levels.options.read') => "read", I18n.t('hyrax.permission_levels.options.edit') => "edit" } end |
#persistent_hostpath ⇒ Object
628 629 630 |
# File 'lib/hyrax/configuration.rb', line 628 def persistent_hostpath @persistent_hostpath ||= "http://localhost/files/" end |
#public_user_group_name ⇒ String
179 180 181 |
# File 'lib/hyrax/configuration.rb', line 179 def public_user_group_name @public_user_group_name ||= 'public' end |
#publisher ⇒ Object
817 818 819 |
# File 'lib/hyrax/configuration.rb', line 817 def publisher @publisher ||= Hyrax::Publisher.instance end |
#query_index_from_valkyrie ⇒ Boolean
Returns whether to use the experimental valkyrie index.
456 457 458 |
# File 'lib/hyrax/configuration.rb', line 456 def query_index_from_valkyrie @query_index_from_valkyrie ||= false end |
#range_for_number_of_results_to_display_per_page ⇒ Array<Integer>
911 912 913 |
# File 'lib/hyrax/configuration.rb', line 911 def range_for_number_of_results_to_display_per_page @range_for_number_of_results_to_display_per_page ||= [10, 20, 50, 100] end |
#realtime_notifications=(value) ⇒ Object (writeonly)
rubocop:disable Layout/LineLength
668 669 670 |
# File 'lib/hyrax/configuration.rb', line 668 def realtime_notifications=(value) @realtime_notifications = value end |
#redis_namespace ⇒ Object
633 634 635 |
# File 'lib/hyrax/configuration.rb', line 633 def redis_namespace @redis_namespace ||= "hyrax" end |
#registered_ingest_dirs ⇒ Object
566 567 568 569 570 571 572 573 574 575 576 |
# File 'lib/hyrax/configuration.rb', line 566 def registered_ingest_dirs @registered_ingest_dirs ||= \ if defined? BrowseEverything file_system_dirs = Array.wrap(BrowseEverything.config['file_system'].try(:[], :home)).compact # Include the Rails tmp directory for cases where the BrowseEverything provider is required to download the file to a temporary directory first tmp_dir = [Rails.root.join('tmp').to_s] file_system_dirs + tmp_dir else [] end end |
#registered_user_group_name ⇒ String
186 187 188 |
# File 'lib/hyrax/configuration.rb', line 186 def registered_user_group_name @registered_user_group_name ||= 'registered' end |
#rendering_predicate ⇒ RDF::URI
defaults to dc:hasFormat
Set predicate for rendering to dc:hasFormat as defined in IIIF Presentation API context: iiif.io/api/presentation/2/context.json
298 299 300 |
# File 'lib/hyrax/configuration.rb', line 298 def rendering_predicate @rendering_predicate ||= ::RDF::Vocab::DC.hasFormat end |
#resource_id_to_uri_transformer ⇒ Object
842 843 844 845 846 847 848 849 850 |
# File 'lib/hyrax/configuration.rb', line 842 def resource_id_to_uri_transformer Deprecation.warn('Use Hyrax.config.translate_uri_to_id instead.') @resource_id_to_uri_transformer ||= lambda do |resource, base_url| file_id = CGI.escape(resource.file_identifier.to_s) fs_id = CGI.escape(resource.file_set_id.to_s) "#{base_url}#{::Noid::Rails.treeify(fs_id)}/files/#{file_id}" end end |
#rights_statement_service_class ⇒ Object
623 624 625 |
# File 'lib/hyrax/configuration.rb', line 623 def rights_statement_service_class @rights_statement_service_class ||= Hyrax::RightsStatementService end |
#show_work_item_rows ⇒ Object
705 706 707 |
# File 'lib/hyrax/configuration.rb', line 705 def show_work_item_rows @show_work_item_rows ||= 10 # rows on show view end |
#solr_select_path ⇒ Object
892 893 894 |
# File 'lib/hyrax/configuration.rb', line 892 def solr_select_path @solr_select_path ||= ActiveFedora.solr_config.fetch(:select_path, 'select') end |
#subject_prefix ⇒ Object
858 859 860 |
# File 'lib/hyrax/configuration.rb', line 858 def subject_prefix @subject_prefix ||= "Contact form:" end |
#system_user_key ⇒ Object
713 714 715 |
# File 'lib/hyrax/configuration.rb', line 713 def system_user_key @system_user_key ||= '[email protected]' end |
#temp_file_base ⇒ Object
Returns the value of attribute temp_file_base.
474 475 476 |
# File 'lib/hyrax/configuration.rb', line 474 def temp_file_base @temp_file_base end |
#translate_id_to_uri ⇒ Object
835 836 837 838 839 |
# File 'lib/hyrax/configuration.rb', line 835 def translate_id_to_uri @translate_id_to_uri ||= lambda do |id| "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/#{::Noid::Rails.treeify(id)}" end end |
#translate_uri_to_id ⇒ Object
823 824 825 826 827 828 829 830 831 832 |
# File 'lib/hyrax/configuration.rb', line 823 def translate_uri_to_id @translate_uri_to_id ||= begin baseparts = 2 + [(::Noid::Rails.config.template.gsub(/\.[rsz]/, '').length.to_f / 2).ceil, 4].min lambda do |uri| uri.to_s.split(ActiveFedora.fedora.base_path).last.split('/', baseparts).last end end end |
#upload_path ⇒ Object
327 328 329 |
# File 'lib/hyrax/configuration.rb', line 327 def upload_path @upload_path ||= ->() { ENV.fetch('HYRAX_UPLOAD_PATH') { Rails.root.join('tmp', 'uploads') } } end |
#uploader ⇒ Object
869 870 871 872 873 874 875 876 |
# File 'lib/hyrax/configuration.rb', line 869 def uploader @uploader ||= if Rails.env.development? # use sequential uploads in development to avoid database locking problems with sqlite3. default_uploader_config.merge(limitConcurrentUploads: 1, sequentialUploads: true) else default_uploader_config end end |
#virus_scanner ⇒ Object
382 383 384 385 386 387 388 389 |
# File 'lib/hyrax/configuration.rb', line 382 def virus_scanner @virus_scanner ||= if Hyrax.primary_work_type.respond_to?(:default_system_virus_scanner) Hyrax.primary_work_type.default_system_virus_scanner else Hyrax::VirusScanner end end |
#work_requires_files=(value) ⇒ Object (writeonly)
Sets the attribute work_requires_files
698 699 700 |
# File 'lib/hyrax/configuration.rb', line 698 def work_requires_files=(value) @work_requires_files = value end |
#working_path ⇒ Object
320 321 322 |
# File 'lib/hyrax/configuration.rb', line 320 def working_path @working_path ||= ENV.fetch('HYRAX_UPLOAD_PATH', Rails.root.join('tmp', 'uploads')) end |
Instance Method Details
#active_deposit_agreement_acceptance? ⇒ Boolean
688 689 690 691 |
# File 'lib/hyrax/configuration.rb', line 688 def active_deposit_agreement_acceptance? return true if @active_deposit_agreement_acceptance.nil? @active_deposit_agreement_acceptance end |
#admin_set_class ⇒ Class
Returns the configured admin set model class.
756 757 758 |
# File 'lib/hyrax/configuration.rb', line 756 def admin_set_class admin_set_model.constantize end |
#analytics? ⇒ Boolean
110 111 112 113 |
# File 'lib/hyrax/configuration.rb', line 110 def analytics? @analytics ||= ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_ANALYTICS', false)) end |
#arkivo_api? ⇒ Boolean
663 664 665 |
# File 'lib/hyrax/configuration.rb', line 663 def arkivo_api? @arkivo_api ||= false end |
#branding_storage_adapter ⇒ Valkyrie::StorageAdapter
420 421 422 |
# File 'lib/hyrax/configuration.rb', line 420 def branding_storage_adapter @branding_storage_adapter ||= Valkyrie::StorageAdapter.find(:branding_disk) end |
#branding_storage_adapter=(adapter) ⇒ Object
426 427 428 |
# File 'lib/hyrax/configuration.rb', line 426 def branding_storage_adapter=(adapter) @branding_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym) end |
#browse_everything? ⇒ Boolean
643 644 645 |
# File 'lib/hyrax/configuration.rb', line 643 def browse_everything? @browse_everything ||= nil end |
#citations? ⇒ Boolean
648 649 650 |
# File 'lib/hyrax/configuration.rb', line 648 def citations? @citations ||= false end |
#collection_class ⇒ Class
Returns the configured collection model class.
742 743 744 |
# File 'lib/hyrax/configuration.rb', line 742 def collection_class collection_model.safe_constantize end |
#curation_concerns ⇒ Array<Class>
Returns the registered curation concerns.
601 602 603 |
# File 'lib/hyrax/configuration.rb', line 601 def curation_concerns registered_curation_concern_types.map(&:constantize) end |
#default_admin_set ⇒ Hyrax::AdministrativeSet
Returns the default admin set.
769 770 771 |
# File 'lib/hyrax/configuration.rb', line 769 def default_admin_set @default_admin_set ||= Hyrax::AdminSetCreateService.find_or_create_default_admin_set end |
#default_admin_set_id ⇒ String
Returns the default admin set id.
762 763 764 |
# File 'lib/hyrax/configuration.rb', line 762 def default_admin_set_id default_admin_set.id.to_s end |
#default_nested_relationship_reindexer ⇒ Object
883 884 885 886 887 888 889 |
# File 'lib/hyrax/configuration.rb', line 883 def default_nested_relationship_reindexer if use_solr_graph_for_collection_nesting ->(id:, extent:) {} else ->(id:, extent:) { Samvera::NestingIndexer.reindex_relationships(id: id, extent: extent) } end end |
#derivatives_storage_adapter ⇒ Valkyrie::StorageAdapter
432 433 434 |
# File 'lib/hyrax/configuration.rb', line 432 def derivatives_storage_adapter @derivatives_storage_adapter ||= Valkyrie::StorageAdapter.find(:derivatives_disk) end |
#derivatives_storage_adapter=(adapter) ⇒ Object
438 439 440 |
# File 'lib/hyrax/configuration.rb', line 438 def derivatives_storage_adapter=(adapter) @derivatives_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym) end |
#display_media_download_link? ⇒ Boolean
410 411 412 413 |
# File 'lib/hyrax/configuration.rb', line 410 def display_media_download_link? return @display_media_download_link unless @display_media_download_link.nil? @display_media_download_link = true end |
#display_microdata? ⇒ Boolean
477 478 479 480 |
# File 'lib/hyrax/configuration.rb', line 477 def display_microdata? return @display_microdata unless @display_microdata.nil? @display_microdata = true end |
#display_share_button_when_not_logged_in? ⇒ Boolean
793 794 795 796 |
# File 'lib/hyrax/configuration.rb', line 793 def return true if @display_share_button_when_not_logged_in.nil? @display_share_button_when_not_logged_in end |
#enable_noids? ⇒ Boolean
194 195 196 197 |
# File 'lib/hyrax/configuration.rb', line 194 def enable_noids? return @enable_noids unless @enable_noids.nil? @enable_noids = true end |
#extract_full_text? ⇒ Boolean
863 864 865 866 |
# File 'lib/hyrax/configuration.rb', line 863 def extract_full_text? return @extract_full_text unless @extract_full_text.nil? @extract_full_text = true end |
#geonames_username=(username) ⇒ Object
rubocop:enable Layout/LineLength
683 684 685 |
# File 'lib/hyrax/configuration.rb', line 683 def geonames_username=(username) Qa::Authorities::Geonames.username = username end |
#google_analytics_id ⇒ Object Also known as: google_analytics_id?
use analytics_id from config/analytics.yml instead
149 150 151 152 |
# File 'lib/hyrax/configuration.rb', line 149 def google_analytics_id Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.") Hyrax::Analytics.config.analytics_id end |
#google_analytics_id=(value) ⇒ Object
use analytics_id from config/analytics.yml instead
142 143 144 145 |
# File 'lib/hyrax/configuration.rb', line 142 def google_analytics_id=(value) Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.") Hyrax::Analytics.config.analytics_id = value end |
#iiif_image_server? ⇒ Boolean
Default is false
Enable IIIF image service. This is required to use the IIIF viewer enabled show page
If you have run the hyrax:riiif generator, an embedded riiif service will be used to deliver images via IIIF. If you have not, you will need to configure the following other configuration values to work with your image server.
242 243 244 245 |
# File 'lib/hyrax/configuration.rb', line 242 def iiif_image_server? return @iiif_image_server unless @iiif_image_server.nil? @iiif_image_server = false end |
#index_adapter ⇒ #save, ...
Returns an indexing adapter.
444 445 446 |
# File 'lib/hyrax/configuration.rb', line 444 def index_adapter @index_adapter ||= Valkyrie::IndexingAdapter.find(:null_index) end |
#index_adapter=(adapter) ⇒ Object
450 451 452 |
# File 'lib/hyrax/configuration.rb', line 450 def index_adapter=(adapter) @index_adapter = Valkyrie::IndexingAdapter.find(adapter.to_sym) end |
#realtime_notifications? ⇒ Boolean
669 670 671 672 673 674 675 676 677 678 679 680 |
# File 'lib/hyrax/configuration.rb', line 669 def realtime_notifications? # Coerce @realtime_notifications to false if server software # does not support WebSockets, and warn the user that we are # overriding the value in0 their config unless it's already # flipped to false if ENV.fetch('SERVER_SOFTWARE', '').match(/Apache.*Phusion_Passenger/).present? Rails.logger.warn('Cannot enable realtime notifications atop Passenger + Apache. Coercing `Hyrax.config.realtime_notifications` to `false`. Set this value to `false` in config/initializers/hyrax.rb to stop seeing this warning.') unless @realtime_notifications == false @realtime_notifications = false end return @realtime_notifications unless @realtime_notifications.nil? @realtime_notifications = true end |
#register_curation_concern(*curation_concern_types) ⇒ Object
Registers the given curation concern model in the configuration
587 588 589 590 591 |
# File 'lib/hyrax/configuration.rb', line 587 def register_curation_concern(*curation_concern_types) Array.wrap(curation_concern_types).flatten.compact.each do |cc_type| @registered_concerns << cc_type unless @registered_concerns.include?(cc_type) end end |
#register_roles {|Hyrax::RoleRegistry| ... } ⇒ TrueClass
Exposes a means to register application critical roles
101 102 103 104 |
# File 'lib/hyrax/configuration.rb', line 101 def register_roles yield(@role_registry) true end |
#registered_curation_concern_types ⇒ Array<String>
The normalization done by this method must occur after the initialization process so it can take advantage of irregular inflections from config/initializers/inflections.rb
596 597 598 |
# File 'lib/hyrax/configuration.rb', line 596 def registered_curation_concern_types @registered_concerns.map { |cc_type| normalize_concern_name(cc_type) } end |
#reset_default_admin_set ⇒ Object
If the default admin set is changed, call reset. The next time one of the default admin set configs is checked, the default_admin_set variable will be updated.
777 778 779 |
# File 'lib/hyrax/configuration.rb', line 777 def reset_default_admin_set @default_admin_set = nil end |
#use_solr_graph_for_collection_nesting ⇒ Object
878 879 880 |
# File 'lib/hyrax/configuration.rb', line 878 def use_solr_graph_for_collection_nesting ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_USE_SOLR_GRAPH_NESTING', false)) end |
#use_valkyrie? ⇒ Boolean
Returns whether to use experimental valkyrie storage features.
463 464 465 466 |
# File 'lib/hyrax/configuration.rb', line 463 def use_valkyrie? return true if disable_wings # always return true if wings is disabled ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_VALKYRIE', false)) end |
#whitelisted_ingest_dirs ⇒ Object
550 551 552 553 554 |
# File 'lib/hyrax/configuration.rb', line 550 def whitelisted_ingest_dirs Deprecation.warn(self, "Samvera is deprecating #{self.class}#whitelisted_ingest_dirs " \ "in Hyrax 3.0. Instead use #{self.class}#registered_ingest_dirs.") registered_ingest_dirs end |
#whitelisted_ingest_dirs=(input) ⇒ Object
557 558 559 560 561 |
# File 'lib/hyrax/configuration.rb', line 557 def whitelisted_ingest_dirs=(input) Deprecation.warn(self, "Samvera is deprecating #{self.class}#whitelisted_ingest_dirs= " \ "in Hyrax 3.0. Instead use #{self.class}#registered_ingest_dirs=.") self.registered_ingest_dirs = input end |
#work_requires_files? ⇒ Boolean
699 700 701 702 |
# File 'lib/hyrax/configuration.rb', line 699 def work_requires_files? return true if @work_requires_files.nil? @work_requires_files end |