Class: Hyrax::Configuration

Inherits:
Object
  • Object
show all
Includes:
Callbacks
Defined in:
lib/hyrax/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Callbacks

#callback

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



8
9
10
11
12
# File 'lib/hyrax/configuration.rb', line 8

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.



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

def active_deposit_agreement_acceptance=(value)
  @active_deposit_agreement_acceptance = value
end

#activity_to_show_default_seconds_since_nowObject



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

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

#admin_set_predicateObject



320
321
322
# File 'lib/hyrax/configuration.rb', line 320

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

#analytic_start_dateObject

Returns the value of attribute analytic_start_date.



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

def analytic_start_date
  @analytic_start_date
end

#analyticsObject

Returns the value of attribute analytics.



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

def analytics
  @analytics
end

#arkivo_api=(value) ⇒ Object (writeonly)

Sets the attribute arkivo_api

Parameters:

  • value

    the value to set the attribute arkivo_api to.



288
289
290
# File 'lib/hyrax/configuration.rb', line 288

def arkivo_api=(value)
  @arkivo_api = value
end

#audit_user_keyObject



336
337
338
# File 'lib/hyrax/configuration.rb', line 336

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

#bagit_dirObject



175
176
177
# File 'lib/hyrax/configuration.rb', line 175

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


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

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



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

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

#browse_everything=(value) ⇒ Object (writeonly)

Sets the attribute browse_everything

Parameters:

  • value

    the value to set the attribute browse_everything to.



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

def browse_everything=(value)
  @browse_everything = value
end

#cache_pathObject



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

def cache_path
  @cache_path ||= ->() { Rails.root + 'tmp' + 'uploads' + 'cache' }
end

#characterization_runnerObject

Override characterization runner



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

def characterization_runner
  @characterization_runner
end

#citations=(value) ⇒ Object (writeonly)

Sets the attribute citations

Parameters:

  • value

    the value to set the attribute citations to.



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

def citations=(value)
  @citations = value
end

#contact_emailObject



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

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:



26
27
28
# File 'lib/hyrax/configuration.rb', line 26

def default_active_workflow_name
  @default_active_workflow_name
end

#derivatives_pathObject



51
52
53
# File 'lib/hyrax/configuration.rb', line 51

def derivatives_path
  @derivatives_path ||= Rails.root.join('tmp', 'derivatives')
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.



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

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.



85
86
87
# File 'lib/hyrax/configuration.rb', line 85

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?



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

def display_share_button_when_not_logged_in=(value)
  @display_share_button_when_not_logged_in = value
end

#enable_ffmpegObject



62
63
64
65
# File 'lib/hyrax/configuration.rb', line 62

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.



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

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.



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

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.



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

def extract_full_text=(value)
  @extract_full_text = value
end

#feature_config_pathObject



78
79
80
# File 'lib/hyrax/configuration.rb', line 78

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

#ffmpeg_pathObject



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

def ffmpeg_path
  @ffmpeg_path ||= 'ffmpeg'
end

#fits_message_lengthObject



73
74
75
# File 'lib/hyrax/configuration.rb', line 73

def fits_message_length
  @fits_message_length ||= 5
end

#fits_pathObject



129
130
131
# File 'lib/hyrax/configuration.rb', line 129

def fits_path
  @fits_path ||= 'fits.sh'
end

#google_analytics_idObject Also known as: google_analytics_id?



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

def google_analytics_id
  @google_analytics_id ||= nil
end

#import_export_jar_file_pathObject



168
169
170
# File 'lib/hyrax/configuration.rb', line 168

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

#ingest_queue_nameObject



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

def ingest_queue_name
  @ingest_queue_name ||= :default
end

#libreoffice_pathObject



259
260
261
# File 'lib/hyrax/configuration.rb', line 259

def libreoffice_path
  @libreoffice_path ||= "soffice"
end

#license_service_classObject



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

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

#lock_retry_countObject



140
141
142
# File 'lib/hyrax/configuration.rb', line 140

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

#lock_retry_delayObject



154
155
156
# File 'lib/hyrax/configuration.rb', line 154

def lock_retry_delay
  @lock_retry_delay ||= 200 # milliseconds
end

#lock_time_to_liveObject



147
148
149
# File 'lib/hyrax/configuration.rb', line 147

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

#max_days_between_fixity_checksObject



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

def max_days_between_fixity_checks
  @max_days_between_fixity_checks ||= 7
end

#max_notifications_for_dashboardObject



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

def max_notifications_for_dashboard
  @max_notifications_for_dashboard ||= 5
end

#microdata_default_typeObject



92
93
94
# File 'lib/hyrax/configuration.rb', line 92

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

#minter_statefileObject



118
119
120
# File 'lib/hyrax/configuration.rb', line 118

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

#noid_minter_classObject



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

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

#noid_templateObject



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

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

#owner_permission_levelsObject



375
376
377
# File 'lib/hyrax/configuration.rb', line 375

def owner_permission_levels
  @owner_permission_levels ||= { "Edit access" => "edit" }
end

#permission_levelsObject



369
370
371
372
# File 'lib/hyrax/configuration.rb', line 369

def permission_levels
  @permission_levels ||= { "View/Download" => "read",
                           "Edit access" => "edit" }
end

#permission_optionsObject



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

def permission_options
  @permission_options ||= { "Choose Access" => "none",
                            "View/Download" => "read",
                            "Edit" => "edit" }
end

#persistent_hostpathObject



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

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

#realtime_notifications=(value) ⇒ Object (writeonly)

rubocop:disable Metrics/LineLength



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

def realtime_notifications=(value)
  @realtime_notifications = value
end

#redis_namespaceObject



254
255
256
# File 'lib/hyrax/configuration.rb', line 254

def redis_namespace
  @redis_namespace ||= "hyrax"
end

#rights_statement_service_classObject



238
239
240
# File 'lib/hyrax/configuration.rb', line 238

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

#subject_prefixObject



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

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

#temp_file_baseObject

Returns the value of attribute temp_file_base.



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

def temp_file_base
  @temp_file_base
end

#translate_id_to_uriObject



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

def translate_id_to_uri
  @translate_id_to_uri ||= ActiveFedora::Noid.config.translate_id_to_uri
end

#translate_uri_to_idObject



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

def translate_uri_to_id
  @translate_uri_to_id ||= ActiveFedora::Noid.config.translate_uri_to_id
end

#upload_pathObject



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

def upload_path
  @upload_path ||= ->() { Rails.root + 'tmp' + 'uploads' }
end

#uploaderObject



413
414
415
416
417
418
419
420
# File 'lib/hyrax/configuration.rb', line 413

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

#whitelisted_ingest_dirsObject



182
183
184
185
186
187
188
189
# File 'lib/hyrax/configuration.rb', line 182

def whitelisted_ingest_dirs
  @whitelisted_ingest_dirs ||= \
    if defined? BrowseEverything
      Array.wrap(BrowseEverything.config['file_system'].try(:[], :home)).compact
    else
      []
    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.



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

def work_requires_files=(value)
  @work_requires_files = value
end

#working_pathObject



57
58
59
# File 'lib/hyrax/configuration.rb', line 57

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

Instance Method Details

#active_deposit_agreement_acceptance?Boolean

Returns:

  • (Boolean)


314
315
316
317
# File 'lib/hyrax/configuration.rb', line 314

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

#analytics?Boolean

Returns:

  • (Boolean)


269
270
271
# File 'lib/hyrax/configuration.rb', line 269

def analytics?
  @analytics ||= false
end

#arkivo_api?Boolean

Returns:

  • (Boolean)


289
290
291
# File 'lib/hyrax/configuration.rb', line 289

def arkivo_api?
  @arkivo_api ||= false
end

#browse_everything?Boolean

Returns:

  • (Boolean)


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

def browse_everything?
  @browse_everything ||= nil
end

#citations?Boolean

Returns:

  • (Boolean)


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

def citations?
  @citations ||= false
end

#curation_concernsArray<Class>

Returns the registered curation concerns.

Returns:

  • (Array<Class>)

    the registered curation concerns



216
217
218
# File 'lib/hyrax/configuration.rb', line 216

def curation_concerns
  registered_curation_concern_types.map(&:constantize)
end

#display_media_download_link?Boolean

Returns:

  • (Boolean)


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

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)


86
87
88
89
# File 'lib/hyrax/configuration.rb', line 86

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

#display_share_button_when_not_logged_in?Boolean

Returns:

  • (Boolean)


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

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)


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

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

#extract_full_text?Boolean

Returns:

  • (Boolean)


407
408
409
410
# File 'lib/hyrax/configuration.rb', line 407

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

#geonames_username=(username) ⇒ Object

rubocop:enable Metrics/LineLength



309
310
311
# File 'lib/hyrax/configuration.rb', line 309

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

#realtime_notifications?Boolean

Returns:

  • (Boolean)


295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/hyrax/configuration.rb', line 295

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


200
201
202
203
204
205
206
# File 'lib/hyrax/configuration.rb', line 200

def register_curation_concern(*curation_concern_types)
  Array.wrap(curation_concern_types).flatten.compact.each do |cc_type|
    unless @registered_concerns.include?(cc_type)
      @registered_concerns << cc_type
    end
  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)


44
45
46
47
# File 'lib/hyrax/configuration.rb', line 44

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



211
212
213
# File 'lib/hyrax/configuration.rb', line 211

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

#work_requires_files?Boolean

Returns:

  • (Boolean)


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

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