Skip to content

Commit

Permalink
combine before filters
Browse files Browse the repository at this point in the history
  • Loading branch information
afeld committed Aug 20, 2011
1 parent 8e90d80 commit c24e569
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/magickly/app.rb
Expand Up @@ -12,20 +12,19 @@ class App < Sinatra::Base
end

before do
# redirect to MAGICKLY_APP_DOMAIN, if specified
app_host = ENV['MAGICKLY_APP_DOMAIN']
if app_host && request.host != app_host
request_host_with_port = request.env['HTTP_HOST']
redirect request.url.sub(request_host_with_port, app_host), 301
end
end


before do

Magickly.dragonfly.datastore.configure do |d|
# pass cookies to subsequent request
d.cookie_str = request.env["rack.request.cookie_string"]
end

# parse query params so they are ordered
@options = ActiveSupport::OrderedHash.new
request.query_string.split('&').each do |e|
k,v = e.split('=')
Expand Down

0 comments on commit c24e569

Please sign in to comment.