LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > ruby lsapi removes RAILS_ROOT value from ENV

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2010, 10:32 AM
Grzegorz Derebecki Grzegorz Derebecki is offline
Senior Member
 
Join Date: Jun 2007
Posts: 92
Default ruby lsapi removes RAILS_ROOT value from ENV

after include lsapi it removes RAILS_ROOT varible from ENV why?
also why include lsapi chdir to rails_root? rails_runner do this!
(i think it is bad design that include makes something like that)


Code:
require "rubygems"

ENV["RAILS_ROOT"] = "./"


puts "BEFORE: #{ENV["RAILS_ROOT"]}"
require "lsapi"

$stdout = IO::STDOUT

puts "AFTER: #{ENV["RAILS_ROOT"]}"
maby this is problem:

/* Do not need those environments after initialization */
remove_env = rb_str_new( "RAILS_ROOT", 10 );
rb_funcall( env_copy, rb_intern( "delete" ), 1, remove_env );



Also why include lsapi change default stdout? Why it don't to that after calling some start metod like LSAPI.accept or something similar.

Last edited by Grzegorz Derebecki; 05-17-2010 at 10:37 AM..
Reply With Quote
  #2  
Old 05-17-2010, 11:22 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Both are done for efficiency, it requires to copy the environment variables for each request, so we want to keep number of environment variables as small as possible.
For the default stdout, maybe it is not necessary, we receive some requests to redirect it. If we can do it once during initialization, will avoid doing it for each request.

Both are minor details, so there should not be a problem do it one way or the other.

We also thinking to redirect rails exceptions from our stderr.log to the application log, but have no clue how to do it.
Reply With Quote
  #3  
Old 05-17-2010, 11:37 AM
Grzegorz Derebecki Grzegorz Derebecki is offline
Senior Member
 
Join Date: Jun 2007
Posts: 92
Quote:
Originally Posted by mistwang View Post
Both are done for efficiency, it requires to copy the environment variables for each request, so we want to keep number of environment variables as small as possible.
For the default stdout, maybe it is not necessary, we receive some requests to redirect it. If we can do it once during initialization, will avoid doing it for each request.

Both are minor details, so there should not be a problem do it one way or the other.

We also thinking to redirect rails exceptions from our stderr.log to the application log, but have no clue how to do it.
i think RAILS_ROOT shouldn't be removed. Also RAILS_ROOT isn't set once when ruby starts?

By the way i wrote Rails3 runner: http://github.com/madmax/lsws-rails3-runner
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:27 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.