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.



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

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.



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

def active_deposit_agreement_acceptance=(value)
  @active_deposit_agreement_acceptance = value
end

#activity_to_show_default_seconds_since_nowObject



973
974
975
# File 'lib/hyrax/configuration.rb', line 973

def activity_to_show_default_seconds_since_now
  @activity_to_show_default_seconds_since_now ||= 24 * 60 * 60
end

#admin_set_include_metadataBoolean Also known as: admin_set_include_metadata?

Returns whether to include static metadata for admin_sets.

Returns:

  • (Boolean)

    whether to include static metadata for admin_sets



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

attr_writer :admin_set_include_metadata

#admin_set_model#constantize

Returns a string representation of the admin set model.

Returns:

  • (#constantize)

    a string representation of the admin set model



1123
1124
1125
# File 'lib/hyrax/configuration.rb', line 1123

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

#admin_set_predicateObject



1014
1015
1016
# File 'lib/hyrax/configuration.rb', line 1014

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

#admin_user_group_nameString

Returns:

  • (String)


475
476
477
# File 'lib/hyrax/configuration.rb', line 475

def admin_user_group_name
  @admin_user_group_name ||= 'admin'
end

#administrative_set_formClass

Returns:

  • (Class)


1191
1192
1193
# File 'lib/hyrax/configuration.rb', line 1191

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

#administrative_set_indexerClass

Returns:

  • (Class)


1223
1224
1225
# File 'lib/hyrax/configuration.rb', line 1223

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

#analytic_start_dateObject

Returns the value of attribute analytic_start_date.



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

def analytic_start_date
  @analytic_start_date
end

#analyticsObject

Returns the value of attribute analytics.



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

def analytics
  @analytics
end

#analytics_providerObject



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

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

#analytics_reportingObject

Returns the value of attribute analytics_reporting.



134
135
136
# File 'lib/hyrax/configuration.rb', line 134

def analytics_reporting
  @analytics_reporting
end

#analytics_start_dateObject



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

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.



977
978
979
# File 'lib/hyrax/configuration.rb', line 977

def arkivo_api=(value)
  @arkivo_api = value
end

#audit_user_keyObject



1072
1073
1074
# File 'lib/hyrax/configuration.rb', line 1072

def audit_user_key
  @audit_user_key ||= 'audituser@example.com'
end

#bagit_dirObject



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

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


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

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



1067
1068
1069
# File 'lib/hyrax/configuration.rb', line 1067

def batch_user_key
  @batch_user_key ||= 'batchuser@example.com'
end

#branding_pathObject



662
663
664
# File 'lib/hyrax/configuration.rb', line 662

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


725
726
727
# File 'lib/hyrax/configuration.rb', line 725

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.



957
958
959
# File 'lib/hyrax/configuration.rb', line 957

def browse_everything=(value)
  @browse_everything = value
end

#cache_pathObject



656
657
658
# File 'lib/hyrax/configuration.rb', line 656

def cache_path
  @cache_path ||= ->() { Pathname.new(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



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

attr_writer :characterization_options

#characterization_proxyObject



208
209
210
# File 'lib/hyrax/configuration.rb', line 208

def characterization_proxy
  @characterization_proxy ||= :original_file
end

#characterization_runnerObject

Override characterization runner



213
214
215
# File 'lib/hyrax/configuration.rb', line 213

def characterization_runner
  @characterization_runner
end

#characterization_service#run

@ see Hyrax::Characterization::ValkyrieCharacterizationService

Returns:

  • (#run)

    the service to use for charactaerization for Valkyrie objects



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

attr_writer :characterization_service

#citations=(value) ⇒ Object (writeonly)

Sets the attribute citations

Parameters:

  • value

    the value to set the attribute citations to.



962
963
964
# File 'lib/hyrax/configuration.rb', line 962

def citations=(value)
  @citations = value
end

#collection_include_metadataBoolean Also known as: collection_include_metadata?

Returns whether to include static metadata for collections.

Returns:

  • (Boolean)

    whether to include static metadata for collections



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

attr_writer :collection_include_metadata

#collection_model#constantize

Returns a string representation of the collection model.

Returns:

  • (#constantize)

    a string representation of the collection model



1085
1086
1087
# File 'lib/hyrax/configuration.rb', line 1085

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

#collection_type_index_fieldObject



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

def collection_type_index_field
  @collection_type_index_field ||= 'collection_type_gid_ssim'
end

#contact_emailObject



1303
1304
1305
# File 'lib/hyrax/configuration.rb', line 1303

def contact_email
  @contact_email ||= "repo-admin@example.org"
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:



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

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


278
279
280
281
282
283
284
285
# File 'lib/hyrax/configuration.rb', line 278

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:



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

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

#derivatives_pathObject



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

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

#disable_freyjaBoolean

Returns:

  • (Boolean)


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

def disable_freyja
  return @disable_freyja unless @disable_freyja.nil?
  ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_SKIP_FREYJA', false))
end

#disable_friggBoolean

Returns:

  • (Boolean)


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

def disable_frigg
  return @disable_frigg unless @disable_frigg.nil?
  ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_SKIP_FRIGG', false))
end

#disable_include_metadataObject



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

def 
  @disable_include_metadata ||= ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_DISABLE_INCLUDE_METADATA', false))
end

#disable_wingsBoolean

Returns:

  • (Boolean)


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

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.



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

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.



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

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?



1253
1254
1255
# File 'lib/hyrax/configuration.rb', line 1253

def display_share_button_when_not_logged_in=(value)
  @display_share_button_when_not_logged_in = value
end

#enable_ffmpegObject



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

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.



835
836
837
# File 'lib/hyrax/configuration.rb', line 835

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.



496
497
498
# File 'lib/hyrax/configuration.rb', line 496

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.



1312
1313
1314
# File 'lib/hyrax/configuration.rb', line 1312

def extract_full_text=(value)
  @extract_full_text = value
end

#feature_config_pathObject



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

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



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

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



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

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

#file_set_file_serviceClass

Returns implementer of FileSetFileService.

Returns:



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

attr_writer :file_set_file_service

#file_set_formClass

Returns:

  • (Class)


1198
1199
1200
# File 'lib/hyrax/configuration.rb', line 1198

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

#file_set_include_metadataBoolean Also known as: file_set_include_metadata?

Returns whether to include static metadata for file_sets.

Returns:

  • (Boolean)

    whether to include static metadata for file_sets



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

attr_writer :file_set_include_metadata

#file_set_indexerClass

Returns:

  • (Class)


1230
1231
1232
# File 'lib/hyrax/configuration.rb', line 1230

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



301
302
303
# File 'lib/hyrax/configuration.rb', line 301

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

#fits_message_lengthObject



692
693
694
# File 'lib/hyrax/configuration.rb', line 692

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



687
688
689
# File 'lib/hyrax/configuration.rb', line 687

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

#fixity_serviceObject



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

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

#flexibleObject Also known as: flexible?



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

def flexible
  @flexible ||=
    ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_FLEXIBLE', false))
end

#flexible_classesObject



404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/hyrax/configuration.rb', line 404

def flexible_classes
  flexible_env = ENV.fetch('HYRAX_FLEXIBLE_CLASSES', nil)
  flexible_env = flexible_env.split(',').map(&:strip) if flexible_env
  flexible_env ||= if flexible?
                     [
                       Hyrax.config.collection_model,
                       Hyrax.config.file_set_model,
                       Hyrax.config.admin_set_model
                     ]
                   else
                     []
                   end
  @flexible_classes ||= flexible_env
end

#id_fieldObject



1179
1180
1181
# File 'lib/hyrax/configuration.rb', line 1179

def id_field
  @id_field || index_field_mapper.id_field
end

#identifier_registrarsObject



1334
1335
1336
# File 'lib/hyrax/configuration.rb', line 1334

def identifier_registrars
  @identifier_registrars ||= {}
end

#iiif_av_viewer:symbol

A symbol that represents the viewer to render for AV items. Defaults to :universal_viewer but hopefully we can develop more options

Returns:

  • (:symbol)

    viewer partial name



611
612
613
# File 'lib/hyrax/configuration.rb', line 611

def iiif_av_viewer
  @iiif_av_viewer ||= :universal_viewer
end

#iiif_image_compliance_level_uriString

URL that indicates your IIIF image server compliance level

Returns:

  • (String)

    valid IIIF image compliance level URI



569
570
571
# File 'lib/hyrax/configuration.rb', line 569

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.



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

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



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

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



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

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



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

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



592
593
594
# File 'lib/hyrax/configuration.rb', line 592

def iiif_manifest_cache_duration
  @iiif_manifest_cache_duration ||= 30.days.to_i
end

#iiif_manifest_factoryClass

Factory class for generating IIIF manifests

Returns:

  • (Class)

See Also:



602
603
604
# File 'lib/hyrax/configuration.rb', line 602

def iiif_manifest_factory
  @iiif_manifest_factory ||= ::IIIFManifest::ManifestFactory
end

#iiif_metadata_fields#Array

IIIF metadata - fields to display in the metadata section

Returns:

  • (#Array)

    fields



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

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

#import_export_jar_file_pathObject



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

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

#index_field_mapperObject



1184
1185
1186
# File 'lib/hyrax/configuration.rb', line 1184

def index_field_mapper
  @index_field_mapper ||= ActiveFedora.index_field_mapper
end

#ingest_queue_nameObject



873
874
875
# File 'lib/hyrax/configuration.rb', line 873

def ingest_queue_name
  @ingest_queue_name ||= :default
end

#libreoffice_pathObject



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

def libreoffice_path
  @libreoffice_path ||= "soffice"
end

#license_service_classObject



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

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

#location_serviceObject



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

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

#lock_retry_countObject



852
853
854
# File 'lib/hyrax/configuration.rb', line 852

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

#lock_retry_delayObject



866
867
868
# File 'lib/hyrax/configuration.rb', line 866

def lock_retry_delay
  @lock_retry_delay ||= 200 # milliseconds
end

#lock_time_to_liveObject



859
860
861
# File 'lib/hyrax/configuration.rb', line 859

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

#loggerLogger

Returns:

  • (Logger)


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

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

#max_days_between_fixity_checksObject



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

def max_days_between_fixity_checks
  @max_days_between_fixity_checks ||= 7
end

#max_notifications_for_dashboardObject



968
969
970
# File 'lib/hyrax/configuration.rb', line 968

def max_notifications_for_dashboard
  @max_notifications_for_dashboard ||= 5
end

#microdata_default_typeObject



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

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

#minter_statefileObject



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

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

#noid_minter_classObject



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

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

#noid_templateObject



503
504
505
# File 'lib/hyrax/configuration.rb', line 503

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

#owner_permission_levelsObject



1266
1267
1268
# File 'lib/hyrax/configuration.rb', line 1266

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

#pcdm_collection_formClass

Returns:

  • (Class)


1205
1206
1207
# File 'lib/hyrax/configuration.rb', line 1205

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

#pcdm_collection_indexerClass

Returns:

  • (Class)


1237
1238
1239
# File 'lib/hyrax/configuration.rb', line 1237

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

#pcdm_object_form_builderProc

Returns:

  • (Proc)


1212
1213
1214
1215
1216
1217
1218
# File 'lib/hyrax/configuration.rb', line 1212

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)


1244
1245
1246
1247
1248
1249
1250
# File 'lib/hyrax/configuration.rb', line 1244

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



1260
1261
1262
1263
# File 'lib/hyrax/configuration.rb', line 1260

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

#permission_optionsObject



1271
1272
1273
1274
1275
# File 'lib/hyrax/configuration.rb', line 1271

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



942
943
944
# File 'lib/hyrax/configuration.rb', line 942

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

#public_user_group_nameString

Returns:

  • (String)


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

def public_user_group_name
  @public_user_group_name ||= 'public'
end

#publisherObject



1278
1279
1280
# File 'lib/hyrax/configuration.rb', line 1278

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



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

def query_index_from_valkyrie
  @query_index_from_valkyrie ||= false
end

#range_for_number_of_results_to_display_per_pageArray<Integer>

Returns:

  • (Array<Integer>)


1348
1349
1350
# File 'lib/hyrax/configuration.rb', line 1348

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



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

def realtime_notifications=(value)
  @realtime_notifications = value
end

#redirects_enabled=(value) ⇒ Object (writeonly)

See documentation/redirects.md for the redirects feature.



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

def redirects_enabled=(value)
  @redirects_enabled = value
end

#redis_connectionObject

Returns the value of attribute redis_connection.



946
947
948
# File 'lib/hyrax/configuration.rb', line 946

def redis_connection
  @redis_connection
end

#redis_namespaceObject



948
949
950
# File 'lib/hyrax/configuration.rb', line 948

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

#registered_ingest_dirsObject



880
881
882
883
884
885
886
887
888
889
890
# File 'lib/hyrax/configuration.rb', line 880

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)


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

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: http://iiif.io/api/presentation/2/context.json

Returns:

  • (RDF::URI)


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

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

#reserved_redirect_prefixesObject

rubocop:disable Metrics/MethodLength



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/hyrax/configuration.rb', line 372

def reserved_redirect_prefixes # rubocop:disable Metrics/MethodLength
  @reserved_redirect_prefixes ||= %w[
    /.well-known
    /admin
    /api
    /assets
    /batch_edits
    /batch_uploads
    /capabilitylist
    /catalog
    /changelist
    /collections
    /concern
    /content_blocks
    /dashboard
    /downloads
    /embargoes
    /featured_works
    /files
    /leases
    /notifications
    /pages
    /proxies
    /rails
    /resourcelist
    /uploads
    /users
  ]
end

#rights_statement_service_classObject



937
938
939
# File 'lib/hyrax/configuration.rb', line 937

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

#schema_loader_config_search_pathsArray<Pathname> Also known as: simple_schema_loader_config_search_paths, m3_schema_loader_config_search_paths

A configuration for modifying the SimpleSchemaLoader#config_search_paths which will allow gems to add their own metadata yaml files and easily keep them within the gem.

Examples:

Hyrax.config do |config|
  config.simple_schema_loader_config_search_paths.unshift(HykuKnapsack::Engine.root)
end

Hyrax.config.simple_schema_loader_config_search_paths
=> [#<Pathname:/app/samvera>, #<Pathname:/app/samvera/hyrax-webapp>, #<Pathname:/app/samvera/hyrax-webapp/gems/hyrax>]

Returns:

  • (Array<Pathname>)

See Also:

  • SimpleSchemaLoader#config_search_paths


1379
1380
1381
# File 'lib/hyrax/configuration.rb', line 1379

def schema_loader_config_search_paths
  @schema_loader_config_search_paths ||= [Rails.root, Hyrax::Engine.root]
end

#show_work_item_rowsObject



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

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

#solr_default_methodObject



1329
1330
1331
# File 'lib/hyrax/configuration.rb', line 1329

def solr_default_method
  @solr_default_method ||= :post
end

#solr_max_resultsObject



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

def solr_max_results
  @solr_max_results ||= 10_000
end

#solr_rows_per_requestObject



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

def solr_rows_per_request
  @solr_rows_per_request ||= 1_000
end

#solr_select_pathObject



1324
1325
1326
# File 'lib/hyrax/configuration.rb', line 1324

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

#subject_prefixObject



1308
1309
1310
# File 'lib/hyrax/configuration.rb', line 1308

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

#system_user_keyObject



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

def system_user_key
  @system_user_key ||= 'systemuser@example.com'
end

#temp_file_baseObject

Returns the value of attribute temp_file_base.



835
836
837
# File 'lib/hyrax/configuration.rb', line 835

def temp_file_base
  @temp_file_base
end

#translate_id_to_uriObject



1296
1297
1298
1299
1300
# File 'lib/hyrax/configuration.rb', line 1296

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



1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
# File 'lib/hyrax/configuration.rb', line 1284

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



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

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

#uploaderObject



1319
1320
1321
# File 'lib/hyrax/configuration.rb', line 1319

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.



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

def use_valkyrie=(value)
  @use_valkyrie = value
end

#valkyrie_transitionObject

Returns the value of attribute valkyrie_transition.



438
439
440
# File 'lib/hyrax/configuration.rb', line 438

def valkyrie_transition
  @valkyrie_transition
end

#virus_scannerObject



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

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.



1359
1360
1361
# File 'lib/hyrax/configuration.rb', line 1359

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

#work_default_metadataBoolean Also known as: work_default_metadata?

this is deprecated and will be removed in a future release

Returns:

  • (Boolean)

    whether to include static metadata for works



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

attr_writer :work_default_metadata

#work_include_metadataBoolean Also known as: work_include_metadata?

Returns whether to include static metadata for works.

Returns:

  • (Boolean)

    whether to include static metadata for works



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

attr_writer :work_include_metadata

#work_requires_files=(value) ⇒ Object (writeonly)

Sets the attribute work_requires_files

Parameters:

  • value

    the value to set the attribute work_requires_files to.



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

def work_requires_files=(value)
  @work_requires_files = value
end

#working_pathObject



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

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

Instance Method Details

#active_deposit_agreement_acceptance?Boolean

Returns:

  • (Boolean)


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

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



1129
1130
1131
# File 'lib/hyrax/configuration.rb', line 1129

def admin_set_class
  admin_set_model.constantize
end

#admin_set_class_for_wingsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

There are assumptions baked into Wings and tests regarding what the correct conceptual admin set will be. This helps provide that connective tissue.

It is definitely a hack to appease tests and the Double Combo/Goddess adapter migration.



1142
1143
1144
1145
1146
# File 'lib/hyrax/configuration.rb', line 1142

def admin_set_class_for_wings
  return admin_set_class if admin_set_class < Hyrax::Resource

  Hyrax::AdministrativeSet
end

#admin_set_flexible?Boolean

Returns:

  • (Boolean)


419
420
421
# File 'lib/hyrax/configuration.rb', line 419

def admin_set_flexible?
  flexible_classes.include?(admin_set_model) || (admin_set_class.respond_to?(:flexible?) && admin_set_class.flexible?)
end

#analytics?Boolean

Returns:

  • (Boolean)


125
126
127
128
# File 'lib/hyrax/configuration.rb', line 125

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

#analytics_reporting?Boolean

Returns:

  • (Boolean)


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/hyrax/configuration.rb', line 135

def analytics_reporting?
  @analytics_reporting ||= begin
    required_env_vars = %w[
      HYRAX_ANALYTICS_REPORTING
      GOOGLE_ANALYTICS_ID
      GOOGLE_ANALYTICS_PROPERTY_ID
    ]

    required_env_vars << if ENV['GOOGLE_ACCOUNT_JSON'].blank?
                           'GOOGLE_ACCOUNT_JSON_PATH'
                         else
                           'GOOGLE_ACCOUNT_JSON'
                         end

    return false if required_env_vars.any? { |var| ENV.fetch(var, '').blank? }

    ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_ANALYTICS_REPORTING', false))
  end
end

#arkivo_api?Boolean

Returns:

  • (Boolean)


978
979
980
# File 'lib/hyrax/configuration.rb', line 978

def arkivo_api?
  @arkivo_api ||= false
end

#branding_storage_adapterValkyrie::StorageAdapter

Returns:

  • (Valkyrie::StorageAdapter)


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

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

#branding_storage_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)


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

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

#browse_everything?Boolean

Returns:

  • (Boolean)


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

def browse_everything?
  @browse_everything ||= nil
end

#citations?Boolean

Returns:

  • (Boolean)


963
964
965
# File 'lib/hyrax/configuration.rb', line 963

def citations?
  @citations ||= false
end

#collection_classClass

Returns the configured collection model class.

Returns:

  • (Class)

    the configured collection model class



1091
1092
1093
# File 'lib/hyrax/configuration.rb', line 1091

def collection_class
  collection_model.safe_constantize
end

#collection_class_for_wingsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

There are assumptions baked into Wings and tests regarding what the correct conceptual collection will be. This helps provide that connective tissue.

It is definitely a hack to appease tests and the Double Combo/Goddess adapter migration.



1113
1114
1115
1116
1117
# File 'lib/hyrax/configuration.rb', line 1113

def collection_class_for_wings
  return collection_class if collection_class < Hyrax::Resource

  Hyrax::PcdmCollection
end

#collection_flexible?Boolean

Returns:

  • (Boolean)


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

def collection_flexible?
  flexible_classes.include?(collection_model) || (collection_class.respond_to?(:flexible?) && collection_class.flexible?)
end

#curation_concernsArray<Class>

Returns the registered curation concerns.

Returns:

  • (Array<Class>)

    the registered curation concerns



915
916
917
# File 'lib/hyrax/configuration.rb', line 915

def curation_concerns
  registered_curation_concern_types.map(&:constantize)
end

#default_admin_setHyrax::AdministrativeSet

Returns the default admin set.



1166
1167
1168
# File 'lib/hyrax/configuration.rb', line 1166

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



1159
1160
1161
# File 'lib/hyrax/configuration.rb', line 1159

def default_admin_set_id
  default_admin_set.id.to_s
end

#derivatives_storage_adapterValkyrie::StorageAdapter

Returns:

  • (Valkyrie::StorageAdapter)


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

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

#derivatives_storage_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)


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

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

#display_media_download_link?Boolean

Returns:

  • (Boolean)


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

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)


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

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

#display_share_button_when_not_logged_in?Boolean

Returns:

  • (Boolean)


1254
1255
1256
1257
# File 'lib/hyrax/configuration.rb', line 1254

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)


497
498
499
500
# File 'lib/hyrax/configuration.rb', line 497

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

#extract_full_text?Boolean

Returns:

  • (Boolean)


1313
1314
1315
1316
# File 'lib/hyrax/configuration.rb', line 1313

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



307
308
309
# File 'lib/hyrax/configuration.rb', line 307

def file_set_class
  file_set_model.constantize
end

#file_set_flexible?Boolean

Returns:

  • (Boolean)


427
428
429
# File 'lib/hyrax/configuration.rb', line 427

def file_set_flexible?
  flexible_classes.include?(file_set_model) || (file_set_class.respond_to?(:flexible?) && file_set_class.flexible?)
end

#geonames_username=(username) ⇒ Object

rubocop:enable Layout/LineLength



998
999
1000
# File 'lib/hyrax/configuration.rb', line 998

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:



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

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



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

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

#index_adapter=(adapter) ⇒ Object

Parameters:

  • adapter (#to_sym)


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

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



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

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



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/hyrax/configuration.rb', line 215

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)


984
985
986
987
988
989
990
991
992
993
994
995
# File 'lib/hyrax/configuration.rb', line 984

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

#redirects_active?Boolean

Returns true when both feature gates are open. Single source of truth for "is the redirects feature actively in use right now?". Short-circuits on the config so the Flipflop call is safe (the :redirects feature is only registered when the config is on; calling Flipflop.redirects? otherwise raises).

Returns:

  • (Boolean)

    true when both feature gates are open. Single source of truth for "is the redirects feature actively in use right now?". Short-circuits on the config so the Flipflop call is safe (the :redirects feature is only registered when the config is on; calling Flipflop.redirects? otherwise raises).



358
359
360
# File 'lib/hyrax/configuration.rb', line 358

def redirects_active?
  redirects_enabled? && Flipflop.redirects?
end

#redirects_enabled?Boolean Also known as: redirects_enabled

Returns:

  • (Boolean)


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

def redirects_enabled?
  return @redirects_enabled if defined?(@redirects_enabled) && !@redirects_enabled.nil?
  @redirects_enabled = ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_REDIRECTS_ENABLED', false))
end

#register_curation_concern(*curation_concern_types) ⇒ Object

Registers the given curation concern model in the configuration

Parameters:

  • curation_concern_types (Array<Symbol>, Symbol)


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

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)


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

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



910
911
912
# File 'lib/hyrax/configuration.rb', line 910

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.



1174
1175
1176
# File 'lib/hyrax/configuration.rb', line 1174

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



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

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

#valkyrie_file_set_classObject



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

def valkyrie_file_set_class
  file_set_class.ancestors.include?(ActiveFedora::Base) ? Hyrax::FileSet : file_set_class
end

#valkyrie_transition?Boolean

Returns:

  • (Boolean)


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

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

#work_requires_files?Boolean

Returns:

  • (Boolean)


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

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