script/server set environment

Hi all,

I’m attempting to get running with Selenium, and to do so you have to start script/server -e test. However, I’ve noticed that when I start mongrel that way RAILS_ENV is still set to “development”, even though the mongrel startup messages in the console say that it’s starting rails with test.

However, if I start mongrel with mongrel_rails -e test, RAILS_ENV gets correctly set to test.

Can anyone else verify that this is going on? I’ve been through the script/server code and subsequent mongrel startup scripts and I haven’t managed to find where it’s gone wrong yet…



Weird, but RAILS_ENV="test" script/server ?

script/server with defaults yields RAILS_ENV=“development” script/server -e production yields RAILS_ENV=“development” script/server -e test yields RAILS_ENV=“development”

mongrel_rails start yields RAILS_ENV=“development”

mongrel_rails start -e production yields RAILS_ENV=“production” mongrel_rails start -e test yields RAILS_ENV=“test”

So, it appears that RAILS_ENV is not getting set properly when Mongrel is started via script/server -e environment.

The same commands run with script/server webrick -e test yields RAILS_ENV test, etc.

Perhaps this is behavior by design, but the Mongrel startup would lead me to believe that it’s a bug, since Mongrel appears to start up in test but the RAILS_ENV is still hardwired to development regardless of the specified environment.


Yep, I have got the same problem and it seems just a little bug. I was using 'script/server -e production' but mongrel was still in development env. Using mongrel directly everything was ok.


Matt White wrote: