Sha256: df6dc6012c3625fc65ee015fdf311f726f1a4281b2e905d137827fd9f788fa9e

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 Bytes

Contents

require 'erb'
require 'hako/container'

module Hako
  FrontConfig = Struct.new(:type, :container, :s3, :extra)
  class FrontConfig
    S3Config = Struct.new(:region, :bucket, :prefix) do
      def initialize(options)
        self.region = options.fetch('region')
        self.bucket = options.fetch('bucket')
        self.prefix = options.fetch('prefix', nil)
      end

      def key(app_id)
        if prefix
          "#{prefix}/#{app_id}.conf"
        else
          "#{app_id}.conf"
        end
      end
    end

    def initialize(options)
      self.type = options.fetch('type')
      self.container = Container.new(
        'image_tag' => options.fetch('image_tag'),
      )
      self.s3 = S3Config.new(options.fetch('s3'))
      self.extra = options.fetch('extra', {})
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hako-0.4.0 lib/hako/front_config.rb