Sha256: 8fecbd69d9a8e168ffc27c418cd0e79d722d77a3a691e7432ec554f490acc030

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

module Devise
  class SecretKeyFinder
    def initialize(application)
      @application = application
    end

    def find
      if @application.respond_to?(:credentials) && key_exists?(@application.credentials)
        @application.credentials.secret_key_base
      elsif @application.respond_to?(:secrets) && key_exists?(@application.secrets)
        @application.secrets.secret_key_base
      elsif @application.config.respond_to?(:secret_key_base) && key_exists?(@application.config)
        @application.config.secret_key_base
      end
    end

    private

    def key_exists?(object)
      object.secret_key_base.present?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
devise-4.4.3 lib/devise/secret_key_finder.rb