Skip to content

1.6 Cantaloupe Configuration

Andy Smith edited this page Mar 5, 2020 · 8 revisions

Cantaloupe Configuration

Example settings in cantaloupe.properties for development

DELEGATE SCRIPT

  • delegate_script.enabled = true
  • delegate_script.pathname = delegates.rb

SOURCES

  • source.static = HttpSource
  • source.delegate = false

HttpSource

  • HttpSource.lookup_strategy = ScriptLookupStrategy

Delegate File

Example delegates.rb method for development

  def httpsource_resource_info(_options = {})
    # Code from https://slides.com/ksclarke/integrating-cantaloupe/fullscreen#/3
    file_id = context['identifier']

    # Split the parts into Fedora's pseudo-pairtree (only first four pairs)
    paths = file_id.split(/(.{0,2})/).reject!(&:empty?)[0, 4]

    fedora_base = 'http://localhost:8984'
    fedora_path = '/rest/dev'
    fedora_base_url = fedora_base + fedora_path
    url = fedora_base_url + '/' + paths.join('/') + '/' + file_id
    puts "Delegated URL: #{url}"
    url
  end