Sha256: eaa35d06fa679b5dadeb734932dae3680d6f09822fd53cf74fc8f5ac0cf2824e

Contents?: true

Size: 726 Bytes

Versions: 4

Compression:

Stored size: 726 Bytes

Contents

require 'erb'

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hako-0.3.1 lib/hako/front_config.rb
hako-0.3.0 lib/hako/front_config.rb
hako-0.2.1 lib/hako/front_config.rb
hako-0.2.0 lib/hako/front_config.rb