LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   Ruby/Rails (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=20)
-   -   ENV['RAILS_ENV'] returns nil when called inside Rails 2.3.4 initializer (http://www.litespeedtech.com/support/forum/showthread.php?t=3741)

thbar 01-29-2010 02:47 PM

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

mistwang 01-30-2010 07:22 AM

If you use dispatch.lsapi setup, you need to set "RAILS_ENV" in "Environment" configuration for the external app.

thbar 01-30-2010 07:31 AM

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

mistwang 01-30-2010 08:00 AM

It is recommended to patch rack code and use the RailsRunner setup, only need configuration of a rails context.

thbar 01-30-2010 08:56 AM

Thank you - I will try that.

Grzegorz Derebecki 02-03-2010 04:29 AM

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

thbar 02-11-2010 08:47 AM

Hey Grzegorz,

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

Thanks!

-- Thibaut

backlashforblow 07-14-2011 05:22 AM

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. :confused::confused:


All times are GMT -7. The time now is 10:41 PM.