![]() |
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 |
If you use dispatch.lsapi setup, you need to set "RAILS_ENV" in "Environment" configuration for the external app.
|
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 |
It is recommended to patch rack code and use the RailsRunner setup, only need configuration of a rails context.
|
Thank you - I will try that.
|
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 |
Hey Grzegorz,
thanks for the links - I will give these a go next time I deploy to this site (coming weeks). Thanks! -- Thibaut |
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. |