Class: Hyrax::Configuration

Inherits:
Object
  • Object
show all
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:

  • Analytics

  • Files

  • 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

Options for toggling Hyrax’s “Wings” valkyrie adapter and configuring valkyrie.

Examples:

adding configuration with ‘Hyrax.config` (recommended usage)


Hyrax.config do |config|
  config.work_requires_files = true
  config.derivatives_path('tmp/dir/for/derivatives/')
end

See Also:

Analytics collapse

Files collapse

Groups collapse

Identifier Minting collapse

IIIF collapse

Local Storage collapse

System Dependencies collapse

Theme collapse

Valkyrie collapse

Instance Attribute Summary collapse

Analytics collapse

Files collapse

Identifier Minting collapse

IIIF collapse

Theme collapse

Valkyrie collapse

Instance Method Summary collapse

Methods included from Callbacks

#callback

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



65
66
67
68
69
# File 'lib/hyrax/configuration.rb', line 65

def initialize
  @registered_concerns = []
  @role_registry = Hyrax::RoleRegistry.new
  @default_active_workflow_name = DEFAULT_ACTIVE_WORKFLOW_NAME
end

Instance Attribute Details

#active_deposit_agreement_acceptance=(value) ⇒ Object (writeonly)

Sets the attribute active_deposit_agreement_acceptance

Parameters:

  • value

    the value to set the attribute active_deposit_agreement_acceptance to.



813
814
815
# File 'lib/hyrax/configuration.rb', line 813

def active_deposit_agreement_acceptance=(value)
  @active_deposit_agreement_acceptance = value
end

#activity_to_show_default_seconds_since_nowObject



779
780
781
# File 'lib/hyrax/configuration.rb', line 779

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.

Returns:

  • (#constantize)

    a string representation of the admin set model



876
877
878
# File 'lib/hyrax/configuration.rb', line 876

def admin_set_model
  @admin_set_model ||= 'Hyrax::AdministrativeSet'
end

#admin_set_predicateObject



820
821
822
# File 'lib/hyrax/configuration.rb', line 820

def admin_set_predicate
  @admin_set_predicate ||= ::RDF::Vocab::DC.isPartOf
end

#admin_user_group_nameString

Returns:

  • (String)


318
319
320
# File 'lib/hyrax/configuration.rb', line 318

def admin_user_group_name
  @admin_user_group_name ||= 'admin'
end

#administrative_set_formClass

Returns:

  • (Class)


920
921
922
# File 'lib/hyrax/configuration.rb', line 920

def administrative_set_form
  @administrative_set_form ||= Hyrax::Forms::AdministrativeSetForm
end

#administrative_set_indexerClass

Returns:

  • (Class)


952
953
954
# File 'lib/hyrax/configuration.rb', line 952

def administrative_set_indexer
  @administrative_set_indexer ||= Hyrax::Indexers::AdministrativeSetIndexer
end

#analytic_start_dateObject

Returns the value of attribute analytic_start_date.



151
152
153
# File 'lib/hyrax/configuration.rb', line 151

def analytic_start_date
  @analytic_start_date
end

#analyticsObject

Returns the value of attribute analytics.



122
123
124
# File 'lib/hyrax/configuration.rb', line 122

def analytics
  @analytics
end

#analytics_providerObject



131
132
133
134
# File 'lib/hyrax/configuration.rb', line 131

def analytics_provider
  @analytics_provider ||=
    ENV.fetch('HYRAX_ANALYTICS_PROVIDER', 'google')
end

#analytics_start_dateObject



144
145
146
147
# File 'lib/hyrax/configuration.rb', line 144

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

Parameters:

  • value

    the value to set the attribute arkivo_api to.



783
784
785
# File 'lib/hyrax/configuration.rb', line 783

def arkivo_api=(value)
  @arkivo_api = value
end

#audit_user_keyObject



849
850
851
# File 'lib/hyrax/configuration.rb', line 849

def audit_user_key
  @audit_user_key ||= '[email protected]'
end

#bagit_dirObject



454
455
456
# File 'lib/hyrax/configuration.rb', line 454

def bagit_dir
  @bagit_dir ||= "tmp/descriptions"
end


541
542
543
544
# File 'lib/hyrax/configuration.rb', line 541

def banner_image
  # 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_keyObject



844
845
846
# File 'lib/hyrax/configuration.rb', line 844

def batch_user_key
  @batch_user_key ||= '[email protected]'
end

#branding_pathObject



484
485
486
# File 'lib/hyrax/configuration.rb', line 484

def branding_path
  @branding_path ||= ENV.fetch('HYRAX_BRANDING_PATH', Rails.root.join('public', 'branding'))
end


547
548
549
# File 'lib/hyrax/configuration.rb', line 547

def breadcrumb_builder
  @breadcrumb_builder ||= Hyrax::BootstrapBreadcrumbsBuilder
end

#browse_everything=(value) ⇒ Object (writeonly)

Sets the attribute browse_everything

Parameters:

  • value

    the value to set the attribute browse_everything to.



763
764
765
# File 'lib/hyrax/configuration.rb', line 763

def browse_everything=(value)
  @browse_everything = value
end

#cache_pathObject



478
479
480
# File 'lib/hyrax/configuration.rb', line 478

def cache_path
  @cache_path ||= ->() { ENV.fetch('HYRAX_CACHE_PATH') { Rails.root.join('tmp', 'cache') } }
end

#characterization_optionsHash

Returns of options like :fits_servlet.

Returns:

  • (Hash)

    of options like :fits_servlet



171
# File 'lib/hyrax/configuration.rb', line 171

attr_writer :characterization_options

#characterization_proxyObject



181
182
183
# File 'lib/hyrax/configuration.rb', line 181

def characterization_proxy
  @characterization_proxy ||= :original_file
end

#characterization_runnerObject

Override characterization runner



186
187
188
# File 'lib/hyrax/configuration.rb', line 186

def characterization_runner
  @characterization_runner
end

#characterization_service#run

@ see Hyrax::Characterization::ValkyrieCharacterizationService

Returns:

  • (#run)

    the service to use for charactaerization for Valkyrie objects



161
# File 'lib/hyrax/configuration.rb', line 161

attr_writer :characterization_service

#citations=(value) ⇒ Object (writeonly)

Sets the attribute citations

Parameters:

  • value

    the value to set the attribute citations to.



768
769
770
# File 'lib/hyrax/configuration.rb', line 768

def citations=(value)
  @citations = value
end

#collection_model#constantize

Returns a string representation of the collection model.

Returns:

  • (#constantize)

    a string representation of the collection model



862
863
864
# File 'lib/hyrax/configuration.rb', line 862

def collection_model
  @collection_model ||= 'Hyrax::PcdmCollection'
end

#collection_type_index_fieldObject



854
855
856
# File 'lib/hyrax/configuration.rb', line 854

def collection_type_index_field
  @collection_type_index_field ||= 'collection_type_gid_ssim'
end

#contact_emailObject



1032
1033
1034
# File 'lib/hyrax/configuration.rb', line 1032

def contact_email
  @contact_email ||= "[email protected]"
end

#default_active_workflow_nameString

Note:

The active workflow for an admin set can be changed at a later point.

Note:

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.

Returns:

  • (String)

See Also:



96
97
98
# File 'lib/hyrax/configuration.rb', line 96

def default_active_workflow_name
  @default_active_workflow_name
end

#derivative_mime_type_mappingsObject

Note:

these used to be set by Hydra::Works::MimeTypes methods injected into ‘FileSet`. for backwards compatibility, those are used as defaults if present, but since `FileSet` is an application side model (and slated to be removed) we shouldn’t count on it providing these methods.

Maps mimetypes to create_*_derivatives methods

See Also:

  • VaDerivativeService


251
252
253
254
255
256
257
258
# File 'lib/hyrax/configuration.rb', line 251

def derivative_mime_type_mappings
  @derivative_mime_type_mappings ||=
    { audio: lookup_mimes(:audio_mime_types),
      image: lookup_mimes(:image_mime_types),
      office: lookup_mimes(:office_mime_types),
      pdf: lookup_mimes(:pdf_mime_types),
      video: lookup_mimes(:video_mime_types) }
end

#derivative_servicesArray

The registered candidate derivative services. In the array, the first ‘valid?` candidate will handle the derivative generation.

Returns:

  • (Array)

    of objects that conform to Hyrax::DerivativeService interface.

See Also:



266
267
268
# File 'lib/hyrax/configuration.rb', line 266

def derivative_services
  @derivative_services ||= [Hyrax::FileSetDerivativesService]
end

#derivatives_pathObject



460
461
462
# File 'lib/hyrax/configuration.rb', line 460

def derivatives_path
  @derivatives_path ||= ENV.fetch('HYRAX_DERIVATIVES_PATH', Rails.root.join('tmp', 'derivatives'))
end

#disable_wingsBoolean

Returns:

  • (Boolean)


553
554
555
556
# File 'lib/hyrax/configuration.rb', line 553

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

Parameters:

  • value

    the value to set the attribute display_media_download_link to.



559
560
561
# File 'lib/hyrax/configuration.rb', line 559

def display_media_download_link=(value)
  @display_media_download_link = value
end

#display_microdata=(value) ⇒ Object (writeonly)

Sets the attribute display_microdata

Parameters:

  • value

    the value to set the attribute display_microdata to.



643
644
645
# File 'lib/hyrax/configuration.rb', line 643

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?



982
983
984
# File 'lib/hyrax/configuration.rb', line 982

def display_share_button_when_not_logged_in=(value)
  @display_share_button_when_not_logged_in = value
end

#enable_ffmpegObject



492
493
494
495
# File 'lib/hyrax/configuration.rb', line 492

def enable_ffmpeg
  return @enable_ffmpeg unless @enable_ffmpeg.nil?
  @enable_ffmpeg = false
end

#enable_local_ingestObject

Returns the value of attribute enable_local_ingest.



641
642
643
# File 'lib/hyrax/configuration.rb', line 641

def enable_local_ingest
  @enable_local_ingest
end

#enable_noids=(value) ⇒ Object (writeonly)

Sets the attribute enable_noids

Parameters:

  • value

    the value to set the attribute enable_noids to.



339
340
341
# File 'lib/hyrax/configuration.rb', line 339

def enable_noids=(value)
  @enable_noids = value
end

#extract_full_text=(value) ⇒ Object (writeonly)

Sets the attribute extract_full_text

Parameters:

  • value

    the value to set the attribute extract_full_text to.



1041
1042
1043
# File 'lib/hyrax/configuration.rb', line 1041

def extract_full_text=(value)
  @extract_full_text = value
end

#feature_config_pathObject



637
638
639
# File 'lib/hyrax/configuration.rb', line 637

def feature_config_path
  @feature_config_path ||= Rails.root.join('config', 'features.yml')
end

#fedora_connection_builder#call

A HTTP connection to use for Valkyrie Fedora requests

Returns:

  • (#call)

    lambda/proc that generates a Faraday connection



596
597
598
599
600
601
602
603
604
# File 'lib/hyrax/configuration.rb', line 596

def fedora_connection_builder
  @fedora_connection_builder ||= lambda { |url|
    Faraday.new(url) do |f|
      f.request :multipart
      f.request :url_encoded
      f.adapter Faraday.default_adapter
    end
  }
end

#ffmpeg_pathObject

Note:

we recommend setting the FFMPEG path with the ‘HYRAX_FFMPEG_PATH` environment variable



501
502
503
# File 'lib/hyrax/configuration.rb', line 501

def ffmpeg_path
  @ffmpeg_path ||= ENV.fetch('HYRAX_FFMPEG_PATH', 'ffmpeg')
end

#file_set_file_serviceClass

Returns implementer of FileSetFileService.

Returns:



287
# File 'lib/hyrax/configuration.rb', line 287

attr_writer :file_set_file_service

#file_set_formClass

Returns:

  • (Class)


927
928
929
# File 'lib/hyrax/configuration.rb', line 927

def file_set_form
  @file_set_form ||= Hyrax::Forms::FileSetForm
end

#file_set_indexerClass

Returns:

  • (Class)


959
960
961
# File 'lib/hyrax/configuration.rb', line 959

def file_set_indexer
  @file_set_indexer ||= Hyrax::Indexers::FileSetIndexer
end

#file_set_model#constantize

Returns a string representation of the admin set model.

Returns:

  • (#constantize)

    a string representation of the admin set model



274
275
276
# File 'lib/hyrax/configuration.rb', line 274

def file_set_model
  @file_set_model ||= 'Hyrax::FileSet'
end

#fits_message_lengthObject



514
515
516
# File 'lib/hyrax/configuration.rb', line 514

def fits_message_length
  @fits_message_length ||= 5
end

#fits_pathObject

Note:

we recommend setting the FITS path with the ‘HYRAX_FITS_PATH` environment variable



509
510
511
# File 'lib/hyrax/configuration.rb', line 509

def fits_path
  @fits_path ||= ENV.fetch('HYRAX_FITS_PATH', 'fits.sh')
end

#fixity_serviceObject



293
294
295
# File 'lib/hyrax/configuration.rb', line 293

def fixity_service
  @fixity_service ||= Hyrax::Fixity::ActiveFedoraFixityService
end

#id_fieldObject



908
909
910
# File 'lib/hyrax/configuration.rb', line 908

def id_field
  @id_field || index_field_mapper.id_field
end

#identifier_registrarsObject



1063
1064
1065
# File 'lib/hyrax/configuration.rb', line 1063

def identifier_registrars
  @identifier_registrars ||= {}
end

#iiif_image_compliance_level_uriString

URL that indicates your IIIF image server compliance level

Returns:

  • (String)

    valid IIIF image compliance level URI



410
411
412
# File 'lib/hyrax/configuration.rb', line 410

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

Parameters:

  • value

    the value to set the attribute iiif_image_server to.



364
365
366
# File 'lib/hyrax/configuration.rb', line 364

def iiif_image_server=(value)
  @iiif_image_server = value
end

#iiif_image_size_default#String

IIIF image size default

Returns:

  • (#String)

    valid IIIF image size parameter



417
418
419
# File 'lib/hyrax/configuration.rb', line 417

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

Returns:

  • (#call)

    lambda/proc that generates a URL to an image



396
397
398
# File 'lib/hyrax/configuration.rb', line 396

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

Returns:

  • (#call)

    lambda/proc that generates a URL to image info



403
404
405
# File 'lib/hyrax/configuration.rb', line 403

def iiif_info_url_builder
  @iiif_info_url_builder ||= ->(_file_id, _base_url) { '' }
end

#iiif_manifest_cache_durationInteger

Duration in which we should cache the generated IIIF manifest. Default is 30 days (in seconds).



433
434
435
# File 'lib/hyrax/configuration.rb', line 433

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

Returns:

  • (#Array)

    fields



424
425
426
# File 'lib/hyrax/configuration.rb', line 424

def 
  @iiif_metadata_fields ||= Hyrax::Forms::WorkForm.required_fields
end

#import_export_jar_file_pathObject



521
522
523
# File 'lib/hyrax/configuration.rb', line 521

def import_export_jar_file_path
  @import_export_jar_file_path ||= "tmp/fcrepo-import-export.jar"
end

#index_field_mapperObject



913
914
915
# File 'lib/hyrax/configuration.rb', line 913

def index_field_mapper
  @index_field_mapper ||= ActiveFedora.index_field_mapper
end

#ingest_queue_nameObject



679
680
681
# File 'lib/hyrax/configuration.rb', line 679

def ingest_queue_name
  @ingest_queue_name ||= :default
end

#libreoffice_pathObject



759
760
761
# File 'lib/hyrax/configuration.rb', line 759

def libreoffice_path
  @libreoffice_path ||= "soffice"
end

#license_service_classObject



732
733
734
# File 'lib/hyrax/configuration.rb', line 732

def license_service_class
  @license_service_class ||= Hyrax::LicenseService
end

#location_serviceObject



808
809
810
# File 'lib/hyrax/configuration.rb', line 808

def location_service
  @location_service ||= Hyrax::LocationService.new
end

#lock_retry_countObject



658
659
660
# File 'lib/hyrax/configuration.rb', line 658

def lock_retry_count
  @lock_retry_count ||= 600 # Up to 2 minutes of trying at intervals up to 200ms
end

#lock_retry_delayObject



672
673
674
# File 'lib/hyrax/configuration.rb', line 672

def lock_retry_delay
  @lock_retry_delay ||= 200 # milliseconds
end

#lock_time_to_liveObject



665
666
667
# File 'lib/hyrax/configuration.rb', line 665

def lock_time_to_live
  @lock_time_to_live ||= 60_000 # milliseconds
end

#loggerLogger

Returns:

  • (Logger)


79
80
81
82
83
84
85
# File 'lib/hyrax/configuration.rb', line 79

def logger
  @logger ||= if defined?(Rails)
                Rails.logger
              else
                Valkyrie.logger
              end
end

#max_days_between_fixity_checksObject



298
299
300
# File 'lib/hyrax/configuration.rb', line 298

def max_days_between_fixity_checks
  @max_days_between_fixity_checks ||= 7
end

#max_notifications_for_dashboardObject



774
775
776
# File 'lib/hyrax/configuration.rb', line 774

def max_notifications_for_dashboard
  @max_notifications_for_dashboard ||= 5
end

#microdata_default_typeObject



650
651
652
# File 'lib/hyrax/configuration.rb', line 650

def microdata_default_type
  @microdata_default_type ||= 'http://schema.org/CreativeWork'
end

#minter_statefileObject



356
357
358
# File 'lib/hyrax/configuration.rb', line 356

def minter_statefile
  @minter_statefile ||= '/tmp/minter-state'
end

#noid_minter_classObject



351
352
353
# File 'lib/hyrax/configuration.rb', line 351

def noid_minter_class
  @noid_minter_class ||= ::Noid::Rails::Minter::Db
end

#noid_templateObject



346
347
348
# File 'lib/hyrax/configuration.rb', line 346

def noid_template
  @noid_template ||= '.reeddeeddk'
end

#owner_permission_levelsObject



995
996
997
# File 'lib/hyrax/configuration.rb', line 995

def owner_permission_levels
  @owner_permission_levels ||= { I18n.t('hyrax.permission_levels.owner.edit') => "edit" }
end

#pcdm_collection_formClass

Returns:

  • (Class)


934
935
936
# File 'lib/hyrax/configuration.rb', line 934

def pcdm_collection_form
  @pcdm_collection_form ||= Hyrax::Forms::PcdmCollectionForm
end

#pcdm_collection_indexerClass

Returns:

  • (Class)


966
967
968
# File 'lib/hyrax/configuration.rb', line 966

def pcdm_collection_indexer
  @pcdm_collection_indexer ||= Hyrax::Indexers::PcdmCollectionIndexer
end

#pcdm_object_form_builderProc

Returns:

  • (Proc)


941
942
943
944
945
946
947
# File 'lib/hyrax/configuration.rb', line 941

def pcdm_object_form_builder
  return @pcdm_object_form_builder unless @pcdm_object_form_builder.nil?
  "Hyrax::Forms::PcdmObjectForm".constantize # autoload
  @pcdm_object_form_builder = lambda do |model_class|
    Hyrax::Forms::PcdmObjectForm(model_class)
  end
end

#pcdm_object_indexer_builderProc

Returns:

  • (Proc)


973
974
975
976
977
978
979
# File 'lib/hyrax/configuration.rb', line 973

def pcdm_object_indexer_builder
  return @pcdm_object_indexer_builder unless @pcdm_object_indexer_builder.nil?
  "Hyrax::Indexers::PcdmObjectIndexer".constantize # autoload
  @pcdm_object_indexer_builder = lambda do |model_class|
    Hyrax::Indexers::PcdmObjectIndexer(model_class)
  end
end

#permission_levelsObject



989
990
991
992
# File 'lib/hyrax/configuration.rb', line 989

def permission_levels
  @permission_levels ||= { I18n.t('hyrax.permission_levels.read') => "read",
                           I18n.t('hyrax.permission_levels.edit') => "edit" }
end

#permission_optionsObject



1000
1001
1002
1003
1004
# File 'lib/hyrax/configuration.rb', line 1000

def permission_options
  @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_hostpathObject



748
749
750
# File 'lib/hyrax/configuration.rb', line 748

def persistent_hostpath
  @persistent_hostpath ||= "http://localhost/files/"
end

#public_user_group_nameString

Returns:

  • (String)


325
326
327
# File 'lib/hyrax/configuration.rb', line 325

def public_user_group_name
  @public_user_group_name ||= 'public'
end

#publisherObject



1007
1008
1009
# File 'lib/hyrax/configuration.rb', line 1007

def publisher
  @publisher ||= Hyrax::Publisher.instance
end

#query_index_from_valkyrieBoolean

Returns whether to use the valkyrie index.

Returns:

  • (Boolean)

    whether to use the valkyrie index



621
622
623
# File 'lib/hyrax/configuration.rb', line 621

def query_index_from_valkyrie
  @query_index_from_valkyrie ||= false
end

#range_for_number_of_results_to_display_per_pageArray<Integer>

Returns:

  • (Array<Integer>)


1077
1078
1079
# File 'lib/hyrax/configuration.rb', line 1077

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



789
790
791
# File 'lib/hyrax/configuration.rb', line 789

def realtime_notifications=(value)
  @realtime_notifications = value
end

#redis_connectionObject

Returns the value of attribute redis_connection.



752
753
754
# File 'lib/hyrax/configuration.rb', line 752

def redis_connection
  @redis_connection
end

#redis_namespaceObject



754
755
756
# File 'lib/hyrax/configuration.rb', line 754

def redis_namespace
  @redis_namespace ||= ENV.fetch("HYRAX_REDIS_NAMESPACE", "hyrax")
end

#registered_ingest_dirsObject



686
687
688
689
690
691
692
693
694
695
696
# File 'lib/hyrax/configuration.rb', line 686

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_nameString

Returns:

  • (String)


332
333
334
# File 'lib/hyrax/configuration.rb', line 332

def registered_user_group_name
  @registered_user_group_name ||= 'registered'
end

#rendering_predicateRDF::URI

Note:

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

Returns:

  • (RDF::URI)


444
445
446
# File 'lib/hyrax/configuration.rb', line 444

def rendering_predicate
  @rendering_predicate ||= ::RDF::Vocab::DC.hasFormat
end

#rights_statement_service_classObject



743
744
745
# File 'lib/hyrax/configuration.rb', line 743

def rights_statement_service_class
  @rights_statement_service_class ||= Hyrax::RightsStatementService
end

#show_work_item_rowsObject



831
832
833
# File 'lib/hyrax/configuration.rb', line 831

def show_work_item_rows
  @show_work_item_rows ||= 10 # rows on show view
end

#solr_default_methodObject



1058
1059
1060
# File 'lib/hyrax/configuration.rb', line 1058

def solr_default_method
  @solr_default_method ||= :post
end

#solr_select_pathObject



1053
1054
1055
# File 'lib/hyrax/configuration.rb', line 1053

def solr_select_path
  @solr_select_path ||= ActiveFedora.solr_config.fetch(:select_path, 'select')
end

#subject_prefixObject



1037
1038
1039
# File 'lib/hyrax/configuration.rb', line 1037

def subject_prefix
  @subject_prefix ||= "Contact form:"
end

#system_user_keyObject



839
840
841
# File 'lib/hyrax/configuration.rb', line 839

def system_user_key
  @system_user_key ||= '[email protected]'
end

#temp_file_baseObject

Returns the value of attribute temp_file_base.



641
642
643
# File 'lib/hyrax/configuration.rb', line 641

def temp_file_base
  @temp_file_base
end

#translate_id_to_uriObject



1025
1026
1027
1028
1029
# File 'lib/hyrax/configuration.rb', line 1025

def translate_id_to_uri
  @translate_id_to_uri ||= lambda do |id|
    "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/#{::Noid::Rails.treeify(id.to_s)}"
  end
end

#translate_uri_to_idObject



1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
# File 'lib/hyrax/configuration.rb', line 1013

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_pathObject



473
474
475
# File 'lib/hyrax/configuration.rb', line 473

def upload_path
  @upload_path ||= ->() { ENV.fetch('HYRAX_UPLOAD_PATH') { Rails.root.join('tmp', 'uploads') } }
end

#uploaderObject



1048
1049
1050
# File 'lib/hyrax/configuration.rb', line 1048

def uploader
  @uploader ||= default_uploader_config
end

#use_valkyrie=(value) ⇒ Object (writeonly)

Sets the attribute use_valkyrie

Parameters:

  • value

    the value to set the attribute use_valkyrie to.



633
634
635
# File 'lib/hyrax/configuration.rb', line 633

def use_valkyrie=(value)
  @use_valkyrie = value
end

#virus_scannerObject



528
529
530
531
532
533
534
535
# File 'lib/hyrax/configuration.rb', line 528

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

#visibility_mapHyrax::VisibilityMap

A mapping from visibility string values to permissions; the default and reference implementation is provided by VisibilityMap.



1088
1089
1090
# File 'lib/hyrax/configuration.rb', line 1088

def visibility_map
  @visibility_map ||= Hyrax::VisibilityMap.instance
end

#work_requires_files=(value) ⇒ Object (writeonly)

Sets the attribute work_requires_files

Parameters:

  • value

    the value to set the attribute work_requires_files to.



824
825
826
# File 'lib/hyrax/configuration.rb', line 824

def work_requires_files=(value)
  @work_requires_files = value
end

#working_pathObject



466
467
468
# File 'lib/hyrax/configuration.rb', line 466

def working_path
  @working_path ||= ENV.fetch('HYRAX_UPLOAD_PATH', Rails.root.join('tmp', 'uploads'))
end

Instance Method Details

#active_deposit_agreement_acceptance?Boolean

Returns:

  • (Boolean)


814
815
816
817
# File 'lib/hyrax/configuration.rb', line 814

def active_deposit_agreement_acceptance?
  return true if @active_deposit_agreement_acceptance.nil?
  @active_deposit_agreement_acceptance
end

#admin_set_classClass

Returns the configured admin set model class.

Returns:

  • (Class)

    the configured admin set model class



882
883
884
# File 'lib/hyrax/configuration.rb', line 882

def admin_set_class
  admin_set_model.constantize
end

#analytics?Boolean

Returns:

  • (Boolean)


123
124
125
126
# File 'lib/hyrax/configuration.rb', line 123

def analytics?
  @analytics ||=
    ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_ANALYTICS', false))
end

#arkivo_api?Boolean

Returns:

  • (Boolean)


784
785
786
# File 'lib/hyrax/configuration.rb', line 784

def arkivo_api?
  @arkivo_api ||= false
end

#branding_storage_adapterValkyrie::StorageAdapter

Returns:

  • (Valkyrie::StorageAdapter)


571
572
573
# File 'lib/hyrax/configuration.rb', line 571

def branding_storage_adapter
  @branding_storage_adapter ||= Valkyrie::StorageAdapter.find(:branding_disk)
end

#branding_storage_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)


577
578
579
# File 'lib/hyrax/configuration.rb', line 577

def branding_storage_adapter=(adapter)
  @branding_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym)
end

#browse_everything?Boolean

Returns:

  • (Boolean)


764
765
766
# File 'lib/hyrax/configuration.rb', line 764

def browse_everything?
  @browse_everything ||= nil
end

#citations?Boolean

Returns:

  • (Boolean)


769
770
771
# File 'lib/hyrax/configuration.rb', line 769

def citations?
  @citations ||= false
end

#collection_classClass

Returns the configured collection model class.

Returns:

  • (Class)

    the configured collection model class



868
869
870
# File 'lib/hyrax/configuration.rb', line 868

def collection_class
  collection_model.safe_constantize
end

#curation_concernsArray<Class>

Returns the registered curation concerns.

Returns:

  • (Array<Class>)

    the registered curation concerns



721
722
723
# File 'lib/hyrax/configuration.rb', line 721

def curation_concerns
  registered_curation_concern_types.map(&:constantize)
end

#default_admin_setHyrax::AdministrativeSet

Returns the default admin set.



895
896
897
# File 'lib/hyrax/configuration.rb', line 895

def default_admin_set
  @default_admin_set ||= Hyrax::AdminSetCreateService.find_or_create_default_admin_set
end

#default_admin_set_idString

Returns the default admin set id.

Returns:

  • (String)

    the default admin set id



888
889
890
# File 'lib/hyrax/configuration.rb', line 888

def default_admin_set_id
  default_admin_set.id.to_s
end

#derivatives_storage_adapterValkyrie::StorageAdapter

Returns:

  • (Valkyrie::StorageAdapter)


583
584
585
# File 'lib/hyrax/configuration.rb', line 583

def derivatives_storage_adapter
  @derivatives_storage_adapter ||= Valkyrie::StorageAdapter.find(:derivatives_disk)
end

#derivatives_storage_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)


589
590
591
# File 'lib/hyrax/configuration.rb', line 589

def derivatives_storage_adapter=(adapter)
  @derivatives_storage_adapter = Valkyrie::StorageAdapter.find(adapter.to_sym)
end

#display_media_download_link?Boolean

Returns:

  • (Boolean)


561
562
563
564
# File 'lib/hyrax/configuration.rb', line 561

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

Returns:

  • (Boolean)


644
645
646
647
# File 'lib/hyrax/configuration.rb', line 644

def display_microdata?
  return @display_microdata unless @display_microdata.nil?
  @display_microdata = true
end

#display_share_button_when_not_logged_in?Boolean

Returns:

  • (Boolean)


983
984
985
986
# File 'lib/hyrax/configuration.rb', line 983

def display_share_button_when_not_logged_in?
  return true if @display_share_button_when_not_logged_in.nil?
  @display_share_button_when_not_logged_in
end

#enable_noids?Boolean

Returns:

  • (Boolean)


340
341
342
343
# File 'lib/hyrax/configuration.rb', line 340

def enable_noids?
  return @enable_noids unless @enable_noids.nil?
  @enable_noids = true
end

#extract_full_text?Boolean

Returns:

  • (Boolean)


1042
1043
1044
1045
# File 'lib/hyrax/configuration.rb', line 1042

def extract_full_text?
  return @extract_full_text unless @extract_full_text.nil?
  @extract_full_text = true
end

#file_set_classClass

Returns the configured admin set model class.

Returns:

  • (Class)

    the configured admin set model class



280
281
282
# File 'lib/hyrax/configuration.rb', line 280

def file_set_class
  file_set_model.constantize
end

#geonames_username=(username) ⇒ Object

rubocop:enable Layout/LineLength



804
805
806
# File 'lib/hyrax/configuration.rb', line 804

def geonames_username=(username)
  Qa::Authorities::Geonames.username = username
end

#iiif_image_server?Boolean

Note:

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.

Returns:

  • (Boolean)

    true to enable, false to disable

See Also:



388
389
390
391
# File 'lib/hyrax/configuration.rb', line 388

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.

Returns:

  • (#save, #save_all, #delete, #wipe!)

    an indexing adapter



609
610
611
# File 'lib/hyrax/configuration.rb', line 609

def index_adapter
  @index_adapter ||= Valkyrie::IndexingAdapter.find(:null_index)
end

#index_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)


615
616
617
# File 'lib/hyrax/configuration.rb', line 615

def index_adapter=(adapter)
  @index_adapter = Valkyrie::IndexingAdapter.find(adapter.to_sym)
end

#lookup_mimes(type) ⇒ Object

First see if we can get them from the FileSet model. If not, use configuration. FileSet method names for backwards compatibility.

Parameters:

  • type (Symbol)

    as listed in mime_types_map keys, aligned with



234
235
236
237
238
# File 'lib/hyrax/configuration.rb', line 234

def lookup_mimes(type)
  vals = "FileSet".safe_constantize.try(type)
  return vals if vals.is_a?(Array)
  mime_types_map[type]
end

#mime_types_mapObject

rubocop:disable Metrics/MethodLength



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/hyrax/configuration.rb', line 188

def mime_types_map # rubocop:disable Metrics/MethodLength
  {
    audio_mime_types: [
      'audio/mp3',
      'audio/mpeg',
      'audio/wav',
      'audio/x-wave',
      'audio/x-wav',
      'audio/ogg'
    ],
    image_mime_types: [
      'image/png',
      'image/jpeg',
      'image/jpg',
      'image/jp2',
      'image/bmp',
      'image/gif',
      'image/tiff'
    ],
    office_mime_types: [
      'text/rtf',
      'application/msword',
      'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
      'application/vnd.oasis.opendocument.text',
      'application/vnd.ms-excel',
      'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
      'application/vnd.ms-powerpoint',
      'application/vnd.openxmlformats-officedocument.presentationml.presentation'
    ],
    pdf_mime_types: ['application/pdf'],
    video_mime_types: [
      'video/mpeg',
      'video/mp4',
      'video/webm',
      'video/x-msvideo',
      'video/avi',
      'video/quicktime',
      'application/mxf'
    ]
  }
end

#realtime_notifications?Boolean

Returns:

  • (Boolean)


790
791
792
793
794
795
796
797
798
799
800
801
# File 'lib/hyrax/configuration.rb', line 790

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?
    Hyrax.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

Parameters:

  • curation_concern_types (Array<Symbol>, Symbol)


707
708
709
710
711
# File 'lib/hyrax/configuration.rb', line 707

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

Examples:

Hyrax.config.register_roles do |registry|
  registry.add(name: 'captaining', description: 'Grants captain duties')
end

Yields:

Returns:

  • (TrueClass)


114
115
116
117
# File 'lib/hyrax/configuration.rb', line 114

def register_roles
  yield(@role_registry)
  true
end

#registered_curation_concern_typesArray<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

Returns:

  • (Array<String>)

    the class names of the registered curation concerns



716
717
718
# File 'lib/hyrax/configuration.rb', line 716

def registered_curation_concern_types
  @registered_concerns.map { |cc_type| normalize_concern_name(cc_type) }
end

#reset_default_admin_setObject

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.



903
904
905
# File 'lib/hyrax/configuration.rb', line 903

def reset_default_admin_set
  @default_admin_set = nil
end

#use_valkyrie?Boolean

Returns whether to use valkyrie storage features.

Returns:

  • (Boolean)

    whether to use valkyrie storage features



628
629
630
631
632
# File 'lib/hyrax/configuration.rb', line 628

def use_valkyrie?
  return @use_valkyrie unless @use_valkyrie.nil?
  return true if disable_wings # always return true if wings is disabled
  ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_VALKYRIE', false))
end

#work_requires_files?Boolean

Returns:

  • (Boolean)


825
826
827
828
# File 'lib/hyrax/configuration.rb', line 825

def work_requires_files?
  return true if @work_requires_files.nil?
  @work_requires_files
end