# Script/server set environment

**URL:** <https://www.ruby-forum.com/t/script-server-set-environment/76016>\
**Category:** Rails\
**Created:** [November 15, 2006, 9:29am UTC](https://www.ruby-forum.com/t/script-server-set-environment/76016 "2006-11-15T09:29:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [November 15, 2006, 9:29am UTC](https://www.ruby-forum.com/t/script-server-set-environment/76016/1 "2006-11-15T09:29:12Z")

</div>

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…

Thanks,

Matt

–  
Thermal Creative  
[http://blog.thermalcreative.com](http://blog.thermalcreative.com)

---

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [November 15, 2006, 9:31am UTC](https://www.ruby-forum.com/t/script-server-set-environment/76016/2 "2006-11-15T09:31:13Z")

</div>

Weird, but RAILS\_ENV=“test” script/server ?

---

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [November 15, 2006, 10:03am UTC](https://www.ruby-forum.com/t/script-server-set-environment/76016/3 "2006-11-15T10:03:17Z")

</div>

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.

Matt

On 11/15/06, Vishnu G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> that
> 
> >

–  
Thermal Creative  
[http://blog.thermalcreative.com](http://blog.thermalcreative.com)

---

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [November 15, 2006, 3:12pm UTC](https://www.ruby-forum.com/t/script-server-set-environment/76016/4 "2006-11-15T15:12:10Z")

</div>

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.

Priit
