Skip to content

Commit

Permalink
Selector is now defined in one place
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Aug 14, 2018
1 parent b6530f0 commit 8afb580
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/dkim_dns.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
class DkimDns
attr_accessor :private_key, :domain
attr_accessor :private_key, :domain, :selector

def initialize(domain:, private_key:)
def initialize(domain:, private_key:, selector: 'cuttlefish')
@private_key = private_key
@domain = domain
@selector = selector
end

def dkim_domain
"cuttlefish._domainkey.#{domain}"
"#{selector}._domainkey.#{domain}"
end

# The string that needs to be inserted in DNS.
Expand Down Expand Up @@ -39,7 +40,7 @@ def dkim_dns_configured?
end

def sign_mail(mail)
Mail.new(Dkim.sign(mail.to_s, selector: 'cuttlefish', private_key: private_key, domain: domain))
Mail.new(Dkim.sign(mail.to_s, selector: selector, private_key: private_key, domain: domain))
end

private
Expand Down

0 comments on commit 8afb580

Please sign in to comment.