module Shrine::Plugins::DerivationEndpoint

Documentation can be found on shrinerb.com/docs/plugins/derivation_endpoint

Constants

LOG_SUBSCRIBER

Public Class Methods

configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts) click to toggle source
# File lib/shrine/plugins/derivation_endpoint.rb, line 27
def self.configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts)
  uploader.opts[:derivation_endpoint] ||= { options: {}, derivations: {} }
  uploader.opts[:derivation_endpoint][:options].merge!(opts)

  if !uploader.opts[:derivation_endpoint][:options][:secret_key] && !uploader.opts[:derivation_endpoint][:options][:signer]
    fail Error, "must provide :secret_key option to derivation_endpoint plugin when no custom signer is set"
  end

  # instrumentation plugin integration
  uploader.subscribe(:derivation, &log_subscriber) if uploader.respond_to?(:subscribe)
end
load_dependencies(uploader, **) click to toggle source
# File lib/shrine/plugins/derivation_endpoint.rb, line 22
def self.load_dependencies(uploader, **)
  uploader.plugin :rack_response
  uploader.plugin :_urlsafe_serialization
end