[Mongrel] Passing environment to mongrel apps

Pete DeLaurentis pete at nextengine.com
Tue Apr 24 14:43:25 EDT 2007


Thanks!  That did the trick.  I ended up wrapping it in a new bash  
shell, so the environment variable wouldn't leak out to the other  
scripts I start afterward.

bash -c "ENV_NAME=value; mongrel_rails cluster::start"

Appreciate the help,
Pete

On Apr 24, 2007, at 4:30 AM, ufuk kocolu wrote:

> I needed the same thing, if you are on linux just use
>
> export ENV_NAME=value; mongrel_rails start
>
>
>
> Pete DeLaurentis wrote:
>> Hi guys,
>>
>> I'm looking for a way to pass environment variables to my Rails app
>> via Mongrel.  I want to conditionally execute code in environment.rb
>> based on these environment variables.
>>
>> Background:
>>
>> 1. I have some special stuff I want to do when my Rails app first  
>> starts
>> 2. So, stuff it in environment.rb in after_initialize, right?
>> 3. Not this time.  I have several other background processes that
>> include environment.rb, but shouldn't run this code.
>>
>> Some other background:
>>
>> I'm using lighttpd, mongrel, and mongrel_cluster
>>
>> If there's not a way to do this, I can fallback on having all the
>> background processes set an environment variable, but this doesn't
>> seem as clean.
>>
>> Thanks for the help!
>> Pete
>>
>> _______________________________________________
>> Mongrel-users mailing list
>> Mongrel-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-users
>>
>>
>>
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users



More information about the Mongrel-users mailing list