Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/discourse/files/discourse.fcgi

Issue 9377123: Set up proper FastCGI environment for Discourse and use nginx (Closed)
Left Patch Set: Installing gems per user again Created Feb. 16, 2013, 8:33 a.m.
Right Patch Set: Cleaner definition of the environment variables Created Feb. 22, 2013, 1:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/ruby 1 #!/usr/bin/ruby
2
3 require 'etc'
2 4
3 Dir.chdir(File.dirname(__FILE__)) 5 Dir.chdir(File.dirname(__FILE__))
4 ENV['RAILS_ENV'] ||= 'production' 6 ENV['RAILS_ENV'] ||= 'production'
5 ENV['GEM_HOME'] = File.expand_path('~discourse/.gems') 7 ENV['GEM_HOME'] = "#{Etc.getpwuid.dir}/.gems"
6 ENV['GEM_PATH'] = File.expand_path('~discourse/.gems') + ':/var/lib/gems/1.9.1' 8 ENV['GEM_PATH'] = "#{ENV['GEM_HOME']}:/var/lib/gems/1.9.1"
7 9
8 require 'fcgi' 10 require 'fcgi'
9 require_relative 'config/environment' 11 require_relative 'config/environment'
10 12
11 class Rack::PathInfoRewriter 13 class Rack::PathInfoRewriter
12 def initialize(app) 14 def initialize(app)
13 @app = app 15 @app = app
14 end 16 end
15 17
16 def call(env) 18 def call(env)
17 env.delete('SCRIPT_NAME') 19 env.delete('SCRIPT_NAME')
18 parts = env['REQUEST_URI'].split('?') 20 parts = env['REQUEST_URI'].split('?')
19 env['PATH_INFO'] = parts[0] 21 env['PATH_INFO'] = parts[0]
20 env['QUERY_STRING'] = parts[1].to_s 22 env['QUERY_STRING'] = parts[1].to_s
21 @app.call(env) 23 @app.call(env)
22 end 24 end
23 end 25 end
24 26
25 Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Discourse::Application) 27 Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Discourse::Application)
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld