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:

  • 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.

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

Groups collapse

Identifier Minting collapse

IIIF collapse

Local Storage collapse

System Dependencies collapse

Theme collapse

Valkyrie collapse

Instance Attribute Summary collapse

Analytics 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.


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

Parameters:

  • value

    the value to set the attribute active_deposit_agreement_acceptance to.


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

def active_deposit_agreement_acceptance=(value)
  @active_deposit_agreement_acceptance = value
end

#activity_to_show_default_seconds_since_nowObject


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

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


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

def admin_set_model
  @admin_set_model ||= 'AdminSet'
end

#admin_set_predicateObject


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

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

#admin_user_group_nameString

Returns:

  • (String)

157
158
159
# File 'lib/hyrax/configuration.rb', line 157

def admin_user_group_name
  @admin_user_group_name ||= 'admin'
end

#analytic_start_dateObject

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

#analyticsObject

Returns the value of attribute analytics.


109
110
111
# File 'lib/hyrax/configuration.rb', line 109

def analytics
  @analytics
end

#analytics_providerObject


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_dateObject


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

Parameters:

  • value

    the value to set the attribute arkivo_api to.


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

def arkivo_api=(value)
  @arkivo_api = value
end

#audit_user_keyObject


694
695
696
# File 'lib/hyrax/configuration.rb', line 694

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

#bagit_dirObject


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

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

380
381
382
383
# File 'lib/hyrax/configuration.rb', line 380

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


689
690
691
# File 'lib/hyrax/configuration.rb', line 689

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

#branding_pathObject


323
324
325
# File 'lib/hyrax/configuration.rb', line 323

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

Parameters:

  • value

    the value to set the attribute browse_everything to.


613
614
615
# File 'lib/hyrax/configuration.rb', line 613

def browse_everything=(value)
  @browse_everything = value
end

#cache_pathObject


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

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

#characterization_proxyObject


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

def characterization_proxy
  @characterization_proxy ||= :original_file
end

#characterization_runnerObject

Override characterization runner


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

def characterization_runner
  @characterization_runner
end

#characterization_service#run

@ see Hyrax::Characterization::ValkyrieCharacterizationService

Returns:

  • (#run)

    the service to use for charactaerization for Valkyrie objects


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

attr_writer :characterization_service

#citations=(value) ⇒ Object (writeonly)

Sets the attribute citations

Parameters:

  • value

    the value to set the attribute citations to.


618
619
620
# File 'lib/hyrax/configuration.rb', line 618

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


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

def collection_model
  @collection_model ||= '::Collection'
end

#collection_type_index_fieldObject


699
700
701
# File 'lib/hyrax/configuration.rb', line 699

def collection_type_index_field
  @collection_type_index_field ||= 'collection_type_gid_ssim'
end

#contact_emailObject


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

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:


83
84
85
# File 'lib/hyrax/configuration.rb', line 83

def default_active_workflow_name
  @default_active_workflow_name
end

#derivatives_pathObject


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

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

#disable_wingsBoolean

Returns:

  • (Boolean)

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

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.


393
394
395
# File 'lib/hyrax/configuration.rb', line 393

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.


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

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?


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

def display_share_button_when_not_logged_in=(value)
  @display_share_button_when_not_logged_in = value
end

#enable_ffmpegObject


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

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.


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

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.


178
179
180
# File 'lib/hyrax/configuration.rb', line 178

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.


822
823
824
# File 'lib/hyrax/configuration.rb', line 822

def extract_full_text=(value)
  @extract_full_text = value
end

#feature_config_pathObject


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

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

#ffmpeg_pathObject

Note:

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


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

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

#fits_message_lengthObject


353
354
355
# File 'lib/hyrax/configuration.rb', line 353

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


348
349
350
# File 'lib/hyrax/configuration.rb', line 348

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

#fixity_serviceObject


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

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

#id_fieldObject


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

def id_field
  @id_field || index_field_mapper.id_field
end

#identifier_registrarsObject


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

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


249
250
251
# File 'lib/hyrax/configuration.rb', line 249

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.


203
204
205
# File 'lib/hyrax/configuration.rb', line 203

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


256
257
258
# File 'lib/hyrax/configuration.rb', line 256

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


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

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


242
243
244
# File 'lib/hyrax/configuration.rb', line 242

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).


272
273
274
# File 'lib/hyrax/configuration.rb', line 272

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


263
264
265
# File 'lib/hyrax/configuration.rb', line 263

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

#import_export_jar_file_pathObject


360
361
362
# File 'lib/hyrax/configuration.rb', line 360

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

#index_field_mapperObject


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

def index_field_mapper
  @index_field_mapper ||= ActiveFedora.index_field_mapper
end

#ingest_queue_nameObject


530
531
532
# File 'lib/hyrax/configuration.rb', line 530

def ingest_queue_name
  @ingest_queue_name ||= :default
end

#libreoffice_pathObject


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

def libreoffice_path
  @libreoffice_path ||= "soffice"
end

#license_service_classObject


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

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

#lock_retry_countObject


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

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

#lock_retry_delayObject


523
524
525
# File 'lib/hyrax/configuration.rb', line 523

def lock_retry_delay
  @lock_retry_delay ||= 200 # milliseconds
end

#lock_time_to_liveObject


516
517
518
# File 'lib/hyrax/configuration.rb', line 516

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

#max_days_between_fixity_checksObject


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

def max_days_between_fixity_checks
  @max_days_between_fixity_checks ||= 7
end

#max_notifications_for_dashboardObject


624
625
626
# File 'lib/hyrax/configuration.rb', line 624

def max_notifications_for_dashboard
  @max_notifications_for_dashboard ||= 5
end

#microdata_default_typeObject


468
469
470
# File 'lib/hyrax/configuration.rb', line 468

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

#minter_statefileObject


195
196
197
# File 'lib/hyrax/configuration.rb', line 195

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

#nested_relationship_reindexerObject

Returns the value of attribute nested_relationship_reindexer.


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

def nested_relationship_reindexer
  @nested_relationship_reindexer
end

#noid_minter_classObject


190
191
192
# File 'lib/hyrax/configuration.rb', line 190

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

#noid_templateObject


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

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

#owner_permission_levelsObject


776
777
778
# File 'lib/hyrax/configuration.rb', line 776

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

#permission_levelsObject


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

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

#permission_optionsObject


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

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


599
600
601
# File 'lib/hyrax/configuration.rb', line 599

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

#public_user_group_nameString

Returns:

  • (String)

164
165
166
# File 'lib/hyrax/configuration.rb', line 164

def public_user_group_name
  @public_user_group_name ||= 'public'
end

#publisherObject


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

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

#query_index_from_valkyrieBoolean

Returns whether to use the experimental valkyrie index.

Returns:

  • (Boolean)

    whether to use the experimental valkyrie index


441
442
443
# File 'lib/hyrax/configuration.rb', line 441

def query_index_from_valkyrie
  @query_index_from_valkyrie ||= false
end

#range_for_number_of_results_to_display_per_pageArray<Integer>

Returns:

  • (Array<Integer>)

864
865
866
# File 'lib/hyrax/configuration.rb', line 864

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


639
640
641
# File 'lib/hyrax/configuration.rb', line 639

def realtime_notifications=(value)
  @realtime_notifications = value
end

#redis_namespaceObject


604
605
606
# File 'lib/hyrax/configuration.rb', line 604

def redis_namespace
  @redis_namespace ||= "hyrax"
end

#registered_ingest_dirsObject


537
538
539
540
541
542
543
544
545
546
547
# File 'lib/hyrax/configuration.rb', line 537

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)

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

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)

283
284
285
# File 'lib/hyrax/configuration.rb', line 283

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

#rights_statement_service_classObject


594
595
596
# File 'lib/hyrax/configuration.rb', line 594

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

#show_work_item_rowsObject


676
677
678
# File 'lib/hyrax/configuration.rb', line 676

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

#solr_select_pathObject


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

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

#subject_prefixObject


818
819
820
# File 'lib/hyrax/configuration.rb', line 818

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

#system_user_keyObject


684
685
686
# File 'lib/hyrax/configuration.rb', line 684

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

#temp_file_baseObject

Returns the value of attribute temp_file_base.


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

def temp_file_base
  @temp_file_base
end

#translate_id_to_uriObject


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

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_idObject


794
795
796
797
798
799
800
801
802
803
# File 'lib/hyrax/configuration.rb', line 794

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


312
313
314
# File 'lib/hyrax/configuration.rb', line 312

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

#uploaderObject


829
830
831
832
833
834
835
836
# File 'lib/hyrax/configuration.rb', line 829

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_scannerObject


367
368
369
370
371
372
373
374
# File 'lib/hyrax/configuration.rb', line 367

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

Parameters:

  • value

    the value to set the attribute work_requires_files to.


669
670
671
# File 'lib/hyrax/configuration.rb', line 669

def work_requires_files=(value)
  @work_requires_files = value
end

#working_pathObject


305
306
307
# File 'lib/hyrax/configuration.rb', line 305

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)

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

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


727
728
729
# File 'lib/hyrax/configuration.rb', line 727

def admin_set_class
  admin_set_model.constantize
end

#analytics?Boolean

Returns:

  • (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

Returns:

  • (Boolean)

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

def arkivo_api?
  @arkivo_api ||= false
end

#branding_storage_adapterValkyrie::StorageAdapter

Returns:

  • (Valkyrie::StorageAdapter)

405
406
407
# File 'lib/hyrax/configuration.rb', line 405

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

#branding_storage_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)

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

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

#browse_everything?Boolean

Returns:

  • (Boolean)

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

def browse_everything?
  @browse_everything ||= nil
end

#citations?Boolean

Returns:

  • (Boolean)

619
620
621
# File 'lib/hyrax/configuration.rb', line 619

def citations?
  @citations ||= false
end

#collection_classClass

Returns the configured collection model class.

Returns:

  • (Class)

    the configured collection model class


713
714
715
# File 'lib/hyrax/configuration.rb', line 713

def collection_class
  collection_model.safe_constantize
end

#curation_concernsArray<Class>

Returns the registered curation concerns.

Returns:

  • (Array<Class>)

    the registered curation concerns


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

def curation_concerns
  registered_curation_concern_types.map(&:constantize)
end

#default_admin_setHyrax::AdministrativeSet

Returns the default admin set.


740
741
742
# File 'lib/hyrax/configuration.rb', line 740

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


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

def default_admin_set_id
  default_admin_set.id.to_s
end

#default_nested_relationship_reindexerObject


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

def default_nested_relationship_reindexer
  ->(id:, extent:) { Samvera::NestingIndexer.reindex_relationships(id: id, extent: extent) }
end

#derivatives_storage_adapterValkyrie::StorageAdapter

Returns:

  • (Valkyrie::StorageAdapter)

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

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

#derivatives_storage_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)

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

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

#display_media_download_link?Boolean

Returns:

  • (Boolean)

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

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)

462
463
464
465
# File 'lib/hyrax/configuration.rb', line 462

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

#display_share_button_when_not_logged_in?Boolean

Returns:

  • (Boolean)

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

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)

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

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

#extract_full_text?Boolean

Returns:

  • (Boolean)

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

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


654
655
656
# File 'lib/hyrax/configuration.rb', line 654

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:


227
228
229
230
# File 'lib/hyrax/configuration.rb', line 227

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


429
430
431
# File 'lib/hyrax/configuration.rb', line 429

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

#index_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)

435
436
437
# File 'lib/hyrax/configuration.rb', line 435

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

#realtime_notifications?Boolean

Returns:

  • (Boolean)

640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/hyrax/configuration.rb', line 640

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

Parameters:

  • curation_concern_types (Array<Symbol>, Symbol)

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

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)

101
102
103
104
# File 'lib/hyrax/configuration.rb', line 101

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


567
568
569
# File 'lib/hyrax/configuration.rb', line 567

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.


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

def reset_default_admin_set
  @default_admin_set = nil
end

#use_valkyrie?Boolean

Returns whether to use experimental valkyrie storage features.

Returns:

  • (Boolean)

    whether to use experimental valkyrie storage features


448
449
450
451
# File 'lib/hyrax/configuration.rb', line 448

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

#work_requires_files?Boolean

Returns:

  • (Boolean)

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

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