Sha256: 280bf0d8f17f4c1f161e2fcc4ca7925e7558828f4e8f44b1d9610e6e98641967

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

require 'erb'

module Hako
  class FrontConfig < Struct.new(:type, :image_tag, :s3)
    class S3Config < Struct.new(:region, :bucket, :prefix)
      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.image_tag = options.fetch('image_tag')
      self.s3 = S3Config.new(options.fetch('s3'))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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