Project

General

Profile

Download (726 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman-docker / app / models / exposed_port.rb @ 04b6e05e

1
class ExposedPort < DockerParameter
2
  belongs_to :container, :foreign_key => :reference_id, :inverse_of => :exposed_ports
3
  audited :associated_with => :container, :allow_mass_assignment => true
4
  validates :key,  :uniqueness => { :scope => :reference_id }
5
  validates :key,  :numericality => { :only_integer => true,
6
                                       :greater_than => 0,
7
                                       :less_than_or_equal_to => 655_35,
8
                                       :message => "%{value} is not a valid port number" }
9

    
10
  validates :value, :presence => true,
11
                    :inclusion => { :in => %w(tcp udp),
12
                                    :message => "%{value} is not a valid protocol" }
13
end