Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (36 sloc) 1.392 kB
19284e7 @rwdaigle Extraction of template from ryandaigle.com
authored
1 require 'rubygems'
2 require 'bundler/setup'
3
d661d00 @rwdaigle Rebased from app template
authored
4 Bundler.require(:default, ENV['RACK_ENV'])
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
d661d00 @rwdaigle Rebased from app template
authored
29
30 # Old ryan's scraps URLs
31 # http://ryandaigle.com/articles/2009/8/6/what-s-new-in-edge-rails-cleaner-restful-controllers-w-respond_with
32 r301 %r{/articles/(\d{4})/(\d+)/(\d+)/(.+)}, 'http://archives.ryandaigle.com/articles/$1/$2/$3/$4'
33
34 # http://ryandaigle.com/archives/2007/10
35 r301 %r{/archives/(\d{4})/(\d+)}, 'http://archives.ryandaigle.com/archives/$1/$2'
36
3a208ee @rwdaigle Don't redirect XML feed requests
authored
37 # r301 %r{/articles.xml(\?.*)?}, 'http://feeds.feedburner.com/RyansScraps', :if => Proc.new { |rack_env|
38 # ENV['RACK_ENV'] == 'production' && rack_env['HTTP_USER_AGENT'] !~ /FeedBurner/
39 # }
19284e7 @rwdaigle Extraction of template from ryandaigle.com
authored
40 end
41
42 require 'nesta/env'
43 Nesta::Env.root = ::File.expand_path('.', ::File.dirname(__FILE__))
44
45 require 'nesta/app'
46 run Nesta::App
Something went wrong with that request. Please try again.