Sha256: 76a353072b9d7e5d2871b7f3251bf63390c10f398fecebd3f2af0109c6a19a3d

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

require 'mkit/app/model/service'

class ServicePort < ActiveRecord::Base
  belongs_to :service

  def self.create(service:, config:)
    sp = ServicePort.new(service: service, version: service.version)
    sp.parse_config(config)
    sp
  end

  # haproxy support for port range - leave src blank
  # service:
  #   ports:
  #     # src:dest:tcp|http:load-balancing
  #     - 5532:5432:tcp:round_robin
  # model:
  #  service_ports:
  #     - external: 5432
  #       internal: 5432
  #       mode: tcp|http
  #       load_bal:
  def parse_config(config)
    ports = config.split(':')
    self.external_port = ports[0]
    self.internal_port = ports[1]
    self.mode = ports[2]
    self.load_bal = ports[3]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mkit-0.3.0 lib/mkit/app/model/service_port.rb
mkit-0.2.0 lib/mkit/app/model/service_port.rb