Class: Hyrax::Configuration
- Inherits:
-
Object
- Object
- Hyrax::Configuration
- Includes:
- Callbacks
- Defined in:
- lib/hyrax/configuration.rb
Instance Attribute Summary collapse
-
#active_deposit_agreement_acceptance ⇒ Object
writeonly
Sets the attribute active_deposit_agreement_acceptance.
- #activity_to_show_default_seconds_since_now ⇒ Object
- #admin_set_predicate ⇒ Object
-
#analytic_start_date ⇒ Object
Returns the value of attribute analytic_start_date.
-
#analytics ⇒ Object
Returns the value of attribute analytics.
-
#arkivo_api ⇒ Object
writeonly
Sets the attribute arkivo_api.
- #audit_user_key ⇒ Object
- #bagit_dir ⇒ Object
- #banner_image ⇒ Object
- #batch_user_key ⇒ Object
-
#browse_everything ⇒ Object
writeonly
Sets the attribute browse_everything.
- #cache_path ⇒ Object
-
#characterization_runner ⇒ Object
Override characterization runner.
-
#citations ⇒ Object
writeonly
Sets the attribute citations.
- #contact_email ⇒ Object
-
#default_active_workflow_name ⇒ String
When an admin set is created, we need to activate a workflow.
- #derivatives_path ⇒ Object
-
#display_media_download_link ⇒ Object
writeonly
Sets the attribute display_media_download_link.
-
#display_microdata ⇒ Object
writeonly
Sets the attribute display_microdata.
-
#display_share_button_when_not_logged_in ⇒ Object
writeonly
Should a button with “Share my work” show on the front page to users who are not logged in?.
- #enable_ffmpeg ⇒ Object
-
#enable_local_ingest ⇒ Object
Returns the value of attribute enable_local_ingest.
-
#enable_noids ⇒ Object
writeonly
Sets the attribute enable_noids.
-
#extract_full_text ⇒ Object
writeonly
Sets the attribute extract_full_text.
- #feature_config_path ⇒ Object
- #ffmpeg_path ⇒ Object
- #fits_message_length ⇒ Object
- #fits_path ⇒ Object
- #google_analytics_id ⇒ Object (also: #google_analytics_id?)
- #import_export_jar_file_path ⇒ Object
- #ingest_queue_name ⇒ Object
- #libreoffice_path ⇒ Object
- #license_service_class ⇒ Object
- #lock_retry_count ⇒ Object
- #lock_retry_delay ⇒ Object
- #lock_time_to_live ⇒ Object
- #max_days_between_fixity_checks ⇒ Object
- #max_notifications_for_dashboard ⇒ Object
- #microdata_default_type ⇒ Object
- #minter_statefile ⇒ Object
- #noid_minter_class ⇒ Object
- #noid_template ⇒ Object
- #owner_permission_levels ⇒ Object
- #permission_levels ⇒ Object
- #permission_options ⇒ Object
- #persistent_hostpath ⇒ Object
-
#realtime_notifications ⇒ Object
writeonly
rubocop:disable Metrics/LineLength.
- #redis_namespace ⇒ Object
- #rights_statement_service_class ⇒ Object
- #subject_prefix ⇒ Object
-
#temp_file_base ⇒ Object
Returns the value of attribute temp_file_base.
- #translate_id_to_uri ⇒ Object
- #translate_uri_to_id ⇒ Object
- #upload_path ⇒ Object
- #uploader ⇒ Object
- #whitelisted_ingest_dirs ⇒ Object
-
#work_requires_files ⇒ Object
writeonly
Sets the attribute work_requires_files.
- #working_path ⇒ Object
Instance Method Summary collapse
- #active_deposit_agreement_acceptance? ⇒ Boolean
- #analytics? ⇒ Boolean
- #arkivo_api? ⇒ Boolean
- #browse_everything? ⇒ Boolean
- #citations? ⇒ Boolean
-
#curation_concerns ⇒ Array<Class>
The registered curation concerns.
- #display_media_download_link? ⇒ Boolean
- #display_microdata? ⇒ Boolean
- #display_share_button_when_not_logged_in? ⇒ Boolean
- #enable_noids? ⇒ Boolean
- #extract_full_text? ⇒ Boolean
-
#geonames_username=(username) ⇒ Object
rubocop:enable Metrics/LineLength.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #realtime_notifications? ⇒ Boolean
-
#register_curation_concern(*curation_concern_types) ⇒ Object
Registers the given curation concern model in the configuration.
-
#register_roles {|Hyrax::RoleRegistry| ... } ⇒ TrueClass
Exposes a means to register application critical roles.
-
#registered_curation_concern_types ⇒ Array<String>
The normalization done by this method must occur after the initialization process so it can take advantage of irregular inflections from config/initializers/inflections.rb.
- #work_requires_files? ⇒ Boolean
Methods included from Callbacks
Constructor Details
#initialize ⇒ Configuration
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
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_now ⇒ Object
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_predicate ⇒ Object
320 321 322 |
# File 'lib/hyrax/configuration.rb', line 320 def admin_set_predicate @admin_set_predicate ||= ::RDF::Vocab::DC.isPartOf end |
#analytic_start_date ⇒ Object
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 |
#analytics ⇒ Object
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
288 289 290 |
# File 'lib/hyrax/configuration.rb', line 288 def arkivo_api=(value) @arkivo_api = value end |
#audit_user_key ⇒ Object
336 337 338 |
# File 'lib/hyrax/configuration.rb', line 336 def audit_user_key @audit_user_key ||= '[email protected]' end |
#bagit_dir ⇒ Object
175 176 177 |
# File 'lib/hyrax/configuration.rb', line 175 def bagit_dir @bagit_dir ||= "tmp/descriptions" end |
#banner_image ⇒ Object
243 244 245 246 |
# File 'lib/hyrax/configuration.rb', line 243 def # This image can be used for free and without attribution. See here for source and license: https://github.com/samvera/hyrax/issues/1551#issuecomment-326624909 @banner_image ||= 'https://user-images.githubusercontent.com/101482/29949206-ffa60d2c-8e67-11e7-988d-4910b8787d56.jpg' end |
#batch_user_key ⇒ Object
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
263 264 265 |
# File 'lib/hyrax/configuration.rb', line 263 def browse_everything=(value) @browse_everything = value end |
#cache_path ⇒ Object
347 348 349 |
# File 'lib/hyrax/configuration.rb', line 347 def cache_path @cache_path ||= ->() { Rails.root + 'tmp' + 'uploads' + 'cache' } end |
#characterization_runner ⇒ Object
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
273 274 275 |
# File 'lib/hyrax/configuration.rb', line 273 def citations=(value) @citations = value end |
#contact_email ⇒ Object
397 398 399 |
# File 'lib/hyrax/configuration.rb', line 397 def contact_email @contact_email ||= "[email protected]" end |
#default_active_workflow_name ⇒ String
The active workflow for an admin set can be changed at a later point.
Changing this value after other AdminSet(s) are created does not alter the already created AdminSet(s)
When an admin set is created, we need to activate a workflow. The :default_active_workflow_name is the name of the workflow we will activate.
26 27 28 |
# File 'lib/hyrax/configuration.rb', line 26 def default_active_workflow_name @default_active_workflow_name end |
#derivatives_path ⇒ Object
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
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
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 (value) @display_share_button_when_not_logged_in = value end |
#enable_ffmpeg ⇒ Object
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_ingest ⇒ Object
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
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
406 407 408 |
# File 'lib/hyrax/configuration.rb', line 406 def extract_full_text=(value) @extract_full_text = value end |
#feature_config_path ⇒ Object
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_path ⇒ Object
68 69 70 |
# File 'lib/hyrax/configuration.rb', line 68 def ffmpeg_path @ffmpeg_path ||= 'ffmpeg' end |
#fits_message_length ⇒ Object
73 74 75 |
# File 'lib/hyrax/configuration.rb', line 73 def @fits_message_length ||= 5 end |
#fits_path ⇒ Object
129 130 131 |
# File 'lib/hyrax/configuration.rb', line 129 def fits_path @fits_path ||= 'fits.sh' end |
#google_analytics_id ⇒ Object 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_path ⇒ Object
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_name ⇒ Object
161 162 163 |
# File 'lib/hyrax/configuration.rb', line 161 def ingest_queue_name @ingest_queue_name ||= :default end |
#libreoffice_path ⇒ Object
259 260 261 |
# File 'lib/hyrax/configuration.rb', line 259 def libreoffice_path @libreoffice_path ||= "soffice" end |
#license_service_class ⇒ Object
227 228 229 |
# File 'lib/hyrax/configuration.rb', line 227 def license_service_class @license_service_class ||= Hyrax::LicenseService end |
#lock_retry_count ⇒ Object
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_delay ⇒ Object
154 155 156 |
# File 'lib/hyrax/configuration.rb', line 154 def lock_retry_delay @lock_retry_delay ||= 200 # milliseconds end |
#lock_time_to_live ⇒ Object
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_checks ⇒ Object
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_dashboard ⇒ Object
279 280 281 |
# File 'lib/hyrax/configuration.rb', line 279 def max_notifications_for_dashboard @max_notifications_for_dashboard ||= 5 end |
#microdata_default_type ⇒ Object
92 93 94 |
# File 'lib/hyrax/configuration.rb', line 92 def microdata_default_type @microdata_default_type ||= 'http://schema.org/CreativeWork' end |
#minter_statefile ⇒ Object
118 119 120 |
# File 'lib/hyrax/configuration.rb', line 118 def minter_statefile @minter_statefile ||= '/tmp/minter-state' end |
#noid_minter_class ⇒ Object
113 114 115 |
# File 'lib/hyrax/configuration.rb', line 113 def noid_minter_class @noid_minter_class ||= ActiveFedora::Noid::Minter::Db end |
#noid_template ⇒ Object
108 109 110 |
# File 'lib/hyrax/configuration.rb', line 108 def noid_template @noid_template ||= '.reeddeeddk' end |
#owner_permission_levels ⇒ Object
375 376 377 |
# File 'lib/hyrax/configuration.rb', line 375 def @owner_permission_levels ||= { "Edit access" => "edit" } end |
#permission_levels ⇒ Object
369 370 371 372 |
# File 'lib/hyrax/configuration.rb', line 369 def @permission_levels ||= { "View/Download" => "read", "Edit access" => "edit" } end |
#permission_options ⇒ Object
380 381 382 383 384 |
# File 'lib/hyrax/configuration.rb', line 380 def @permission_options ||= { "Choose Access" => "none", "View/Download" => "read", "Edit" => "edit" } end |
#persistent_hostpath ⇒ Object
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_namespace ⇒ Object
254 255 256 |
# File 'lib/hyrax/configuration.rb', line 254 def redis_namespace @redis_namespace ||= "hyrax" end |
#rights_statement_service_class ⇒ Object
238 239 240 |
# File 'lib/hyrax/configuration.rb', line 238 def rights_statement_service_class @rights_statement_service_class ||= Hyrax::RightsStatementService end |
#subject_prefix ⇒ Object
402 403 404 |
# File 'lib/hyrax/configuration.rb', line 402 def subject_prefix @subject_prefix ||= "Contact form:" end |
#temp_file_base ⇒ Object
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_uri ⇒ Object
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_id ⇒ Object
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_path ⇒ Object
342 343 344 |
# File 'lib/hyrax/configuration.rb', line 342 def upload_path @upload_path ||= ->() { Rails.root + 'tmp' + 'uploads' } end |
#uploader ⇒ Object
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_dirs ⇒ Object
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
324 325 326 |
# File 'lib/hyrax/configuration.rb', line 324 def work_requires_files=(value) @work_requires_files = value end |
#working_path ⇒ Object
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
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
269 270 271 |
# File 'lib/hyrax/configuration.rb', line 269 def analytics? @analytics ||= false end |
#arkivo_api? ⇒ Boolean
289 290 291 |
# File 'lib/hyrax/configuration.rb', line 289 def arkivo_api? @arkivo_api ||= false end |
#browse_everything? ⇒ Boolean
264 265 266 |
# File 'lib/hyrax/configuration.rb', line 264 def browse_everything? @browse_everything ||= nil end |
#citations? ⇒ Boolean
274 275 276 |
# File 'lib/hyrax/configuration.rb', line 274 def citations? @citations ||= false end |
#curation_concerns ⇒ Array<Class>
Returns 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
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
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
353 354 355 356 |
# File 'lib/hyrax/configuration.rb', line 353 def return true if @display_share_button_when_not_logged_in.nil? @display_share_button_when_not_logged_in end |
#enable_noids? ⇒ 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
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
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
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
44 45 46 47 |
# File 'lib/hyrax/configuration.rb', line 44 def register_roles yield(@role_registry) true end |
#registered_curation_concern_types ⇒ Array<String>
The normalization done by this method must occur after the initialization process so it can take advantage of irregular inflections from config/initializers/inflections.rb
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
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 |