Module: CommandTower::CredentialResolution::SmtpActionMailerBridge

Defined in:
lib/command_tower/credential_resolution/smtp_action_mailer_bridge.rb

Overview

Applies resolved SMTP credentials into ActionMailer smtp_settings. Delivery contract remains ActionMailer; Credential Resolution only supplies secrets.

Class Method Summary collapse

Class Method Details

.apply!Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/command_tower/credential_resolution/smtp_action_mailer_bridge.rb', line 10

def apply!
  return unless defined?(Rails) && Rails.respond_to?(:configuration)

  credentials = CredentialResolution.resolve(:smtp)
  return unless credentials.available?

  hash = Rails.configuration.action_mailer.smtp_settings ||= {}
  Rails.configuration.action_mailer.smtp_settings = hash.merge(
    user_name: credentials.user_name,
    password: credentials.password,
  )
end