Sha256: 05b84144aaac9d65801343824db88d62af9276ee6a6fae710f2851f9154ea9eb

Contents?: true

Size: 968 Bytes

Versions: 1

Compression:

Stored size: 968 Bytes

Contents

module Mailkick
  class Engine < ::Rails::Engine
    isolate_namespace Mailkick

    initializer "mailkick" do |app|
      Mailkick.discover_services unless Mailkick.services.any?

      unless Mailkick.secret_token
        Mailkick.secret_token = app.key_generator.generate_key("mailkick")
        Mailkick.message_verifier = ActiveSupport::MessageVerifier.new(Mailkick.secret_token, serializer: JSON)

        # TODO remove in 2.0
        creds =
          if app.respond_to?(:credentials) && app.credentials.secret_key_base
            app.credentials
          elsif app.respond_to?(:secrets) && (Rails::VERSION::STRING.to_f < 7.1 || app.config.paths["config/secrets"].existent.any?)
            app.secrets
          else
            app.config
          end

        token = creds.respond_to?(:secret_key_base) ? creds.secret_key_base : creds.secret_token
        Mailkick.message_verifier.rotate(token, serializer: Marshal) if token
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mailkick-1.3.1 lib/mailkick/engine.rb