lib/mailkick/engine.rb in mailkick-0.2.1 vs lib/mailkick/engine.rb in mailkick-0.3.0
- old
+ new
@@ -2,11 +2,23 @@
class Engine < ::Rails::Engine
isolate_namespace Mailkick
initializer "mailkick" do |app|
Mailkick.discover_services unless Mailkick.services.any?
- secrets = app.respond_to?(:secrets) ? app.secrets : app.config
- Mailkick.secret_token ||= secrets.respond_to?(:secret_key_base) ? secrets.secret_key_base : secrets.secret_token
+
+ Mailkick.secret_token ||= begin
+ creds =
+ if app.respond_to?(:credentials)
+ app.credentials
+ elsif app.respond_to?(:secrets)
+ app.secrets
+ else
+ app.config
+ end
+
+ creds.respond_to?(:secret_key_base) ? creds.secret_key_base : creds.secret_token
+ end
+
ActiveSupport.on_load :action_mailer do
helper Mailkick::UrlHelper
end
end
end