Redirect to S3 file

main
Dan Buch 9 years ago
parent 808cd318ee
commit cece28eaf8

@ -3,6 +3,6 @@ source 'https://rubygems.org'
ruby '2.2.2' if ENV.key?('DYNO')
gem 'aws-sdk', '~> 2'
gem 'puma'
gem 'pry', group: [:development, :test]
gem 'sinatra'
gem 'puma'
gem 'rack'

@ -18,14 +18,7 @@ GEM
slop (~> 3.4)
puma (2.13.4)
rack (1.6.4)
rack-protection (1.5.3)
rack
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slop (3.6.0)
tilt (2.0.1)
PLATFORMS
ruby
@ -34,7 +27,7 @@ DEPENDENCIES
aws-sdk (~> 2)
pry
puma
sinatra
rack
BUNDLED WITH
1.10.6

@ -1,21 +0,0 @@
require 'sinatra/base'
require_relative 'cpi_fetcher'
class App < Sinatra::Base
get '/' do
current_cpi = fetcher.cpi
halt 502 unless current_cpi
expires 300, :public, :must_revalidate
content_type :text
"#{current_cpi}\n"
end
run! if app_file == $PROGRAM_FILE
private
def fetcher
@fetcher ||= CPIFetcher.new
end
end

@ -1,3 +1 @@
require './app'
run App
run lambda { |env| [301, { 'Location' => ENV['CPI_FEED_URL'] }, []] }

Loading…
Cancel
Save