Sha256: 3782471a99cb3b73e6873bdbd37c804a9e3ed20d85fa0b6df51eb620b7243d45

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'mayu'

stores = []
interval = ENV.fetch('MAYU_WEB_RELOAD_INTERVAL', 60).to_i

%w(ASSOC USER AP).each do |k|
  if ENV["MAYU_#{k}_S3_REGION"] && ENV["MAYU_#{k}_S3_BUCKET"] && ENV["MAYU_#{k}_S3_KEY"]
    regions = ENV["MAYU_#{k}_S3_REGION"].split(?;)
    buckets = ENV["MAYU_#{k}_S3_BUCKET"].split(?;)
    keys = ENV["MAYU_#{k}_S3_KEY"].split(?;)
    regions.zip(buckets, keys).each do |region, bucket, key|
      stores.push(
        Mayu::Stores::S3.new(
          region: region || regions.first,
          bucket: bucket || buckets.first,
          key: key || keys.first,
        )
      )
    end
  end
  if ENV["MAYU_#{k}_FILE"]
    files = ENV["MAYU_#{k}_FILE"].split(?;)
    files.each do |file|
      stores.push(
        Mayu::Stores::File.new(
          path: file,
        )
      )
    end
  end
end

store = Mayu::Stores::Concat.new(stores: stores)
loader = Mayu::Loader.new(store: store).load
#binding.irb

run Mayu.app(
  store: store,
  refresh_interval: interval,
  slack_slash_command_token: ENV['MAYU_SLACK_SLASH_COMMAND_TOKEN'],
)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mayu-0.1.0.beta1 config.ru