Skip to content
Newer
Older
100644 40 lines (33 sloc) 1.03 KB
19284e7 @rwdaigle Extraction of template from ryandaigle.com
authored
1 require 'rubygems'
2 require 'bundler/setup'
3
ae58f48 @rwdaigle Deploy script, instructions and starter post
authored
4 Bundler.require(:default, ENV['RACK_ENV'] || 'development')
19284e7 @rwdaigle Extraction of template from ryandaigle.com
authored
5 require 'rack/contrib'
6 require 'newrelic_rpm'
7
537db2c @rwdaigle Trying to fix python lib issue
authored
8 unless ENV['RACK_ENV'] == 'production'
c39813c @rwdaigle Update config.ru ttl and exception configs
authored
9 use Rack::ShowExceptions
10 end
19284e7 @rwdaigle Extraction of template from ryandaigle.com
authored
11
c39813c @rwdaigle Update config.ru ttl and exception configs
authored
12 ttl = ENV['DEFAULT_TTL'] ? ENV['DEFAULT_TTL'].to_i : 3600
19284e7 @rwdaigle Extraction of template from ryandaigle.com
authored
13 use Rack::Cache,
14 :verbose => true,
15 :default_ttl => ttl,
16 :allow_reload => true,
17 :allow_revalidate => true,
18 :private_headers => [],
19 :metastore => "memcached://#{ENV['MEMCACHE_SERVERS'] || 'localhost:11211'}/meta",
20 :entitystore => "file:tmp/cache/rack/body"
21
22 use Rack::ResponseHeaders do |headers|
23 headers['Cache-Control'] = "public, max-age=#{ttl}"
24 end
25 use Rack::ETag
26 use Rack::CommonLogger
27
28 use Rack::Rewrite do
ae58f48 @rwdaigle Deploy script, instructions and starter post
authored
29 if feed_url = ENV['NESTA_FEED_URL']
30 r301 %r{/articles.xml(\?.*)?}, feed_url, :if => Proc.new { |rack_env|
31 ENV['RACK_ENV'] == 'production' && rack_env['HTTP_USER_AGENT'] !~ /FeedBurner/
32 }
33 end
19284e7 @rwdaigle Extraction of template from ryandaigle.com
authored
34 end
35
36 require 'nesta/env'
37 Nesta::Env.root = ::File.expand_path('.', ::File.dirname(__FILE__))
38
39 require 'nesta/app'
40 run Nesta::App
Something went wrong with that request. Please try again.