Class: PostDB::Domain

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/postdb/domain.rb

Instance Method Summary collapse

Instance Method Details

#dkim_pathObject

Get the path to the DKIM key file

Example:

>> domain.dkim_path
=> "..."


43
44
45
46
47
# File 'lib/postdb/domain.rb', line 43

def dkim_path
  keys_directory = PostDB::DKIM.keys_directory

  File.join(keys_directory, "#{self.name}.private")
end

#forwarding_aliasesObject

Get all forwarding aliases This excludes aliases where source == destination

Example:

>> domain.forwarding_aliases
=> []


32
33
34
35
# File 'lib/postdb/domain.rb', line 32

def forwarding_aliases
  # self.aliases.select { |a| a.source != a.destination }
  self.aliases.where('source != destination')
end

#regenerate_dkim(size = 2048) ⇒ Object

Generate a new DKIM key

Arguments:

size: (Integer) (Default: 2048)

Example:

>> domain.regenerate_dkim
=> #<OpenSSL::PKey::RSA:0x00000000000000>


58
59
60
# File 'lib/postdb/domain.rb', line 58

def regenerate_dkim(size = 2048)
  self.dkim = OpenSSL::PKey::RSA.new(size)
end