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

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > ENV['RAILS_ENV'] returns nil when called inside Rails 2.3.4 initializer

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2010, 02:47 PM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Default ENV['RAILS_ENV'] returns nil when called inside Rails 2.3.4 initializer

Hello,

if I use an initializer under config/initializer/myfile.rb, it seems that when the code is called, ENV['RAILS_ENV'] is empty when I use LiteSpeed, whereas it has a value of development or production if I use ruby script/server.

Is it a known issue ?

My work-around has been to hard-code to production for the moment.

thanks,

-- Thibaut
Reply With Quote
  #2  
Old 01-30-2010, 07:22 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
If you use dispatch.lsapi setup, you need to set "RAILS_ENV" in "Environment" configuration for the external app.
Reply With Quote
  #3  
Old 01-30-2010, 07:31 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
I've been reading a lot but I'm not sure what's the right way to do things.

I have a virtual host, but it doesn't have anything in the "external app" tab. Should I add a lsapi external app ?

I'm a bit confused about dispatch.lsapi vs RailsRunner etc - what is the recommended way to run a Rails 2.3.4 app ?

thanks,

-- Thibaut
Reply With Quote
  #4  
Old 01-30-2010, 08:00 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
It is recommended to patch rack code and use the RailsRunner setup, only need configuration of a rails context.
Reply With Quote
  #5  
Old 01-30-2010, 08:56 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Thank you - I will try that.
Reply With Quote
  #6  
Old 02-03-2010, 04:29 AM
Grzegorz Derebecki Grzegorz Derebecki is offline
Senior Member
 
Join Date: Jun 2007
Posts: 92
There is a bug in Rack::Handler::LSWS and after call this ENV varible is empty.

here is my fix:
http://www.litespeedtech.com/support...ead.php?t=3499

and here is my full rails runner (litle modified)

http://www.litespeedtech.com/support...ead.php?t=3750
Reply With Quote
  #7  
Old 02-11-2010, 08:47 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Hey Grzegorz,

thanks for the links - I will give these a go next time I deploy to this site (coming weeks).

Thanks!

-- Thibaut
Reply With Quote
  #8  
Old 07-14-2011, 05:22 AM
backlashforblow backlashforblow is offline
New Member
 
Join Date: Jul 2011
Posts: 1
I used to work with rails 2.3.2 before and then
I decided to upgrade to version 2.3.4. " ERRORS ARE STILL THERE "
I don't know why this is happening. Everything worked
fine in 2.3.2 and now it doesn't.
__________________
Wedding Hairstyles
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 12:56 AM.



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