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

Side by Side Diff: modules/discourse/files/discourse.fcgi

Issue 9377123: Set up proper FastCGI environment for Discourse and use nginx (Closed)
Patch Set: Converted init_discourse script to Python Created Feb. 18, 2013, 2:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/ruby
2
3 Dir.chdir(File.dirname(__FILE__))
4 ENV['RAILS_ENV'] ||= 'production'
5 ENV['GEM_HOME'] = File.expand_path('~discourse/.gems')
6 ENV['GEM_PATH'] = File.expand_path('~discourse/.gems') + ':/var/lib/gems/1.9.1'
Felix Dahlke 2013/02/21 15:56:02 How about ENV['GEM_HOME'] + ':/var/lib/gems/1.9.1'
Wladimir Palant 2013/02/22 13:52:54 Done that and also got rid of the hardcoded user n
Felix Dahlke 2013/02/22 13:56:01 That should do: gem env gemdir
Wladimir Palant 2013/02/22 13:59:34 And now from inside Ruby please, without starting
Wladimir Palant 2013/02/27 17:03:02 Now that we are no longer using FCGI this should b
7
8 require 'fcgi'
9 require_relative 'config/environment'
10
11 class Rack::PathInfoRewriter
12 def initialize(app)
13 @app = app
14 end
15
16 def call(env)
17 env.delete('SCRIPT_NAME')
18 parts = env['REQUEST_URI'].split('?')
19 env['PATH_INFO'] = parts[0]
20 env['QUERY_STRING'] = parts[1].to_s
21 @app.call(env)
22 end
23 end
24
25 Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(Discourse::Application)
OLDNEW

Powered by Google App Engine
This is Rietveld