[Mongrel] setting enviroment variable

ufuk kocolu ufuk at pilli.com
Tue Feb 6 07:41:22 EST 2007


Luis Lavena wrote:
> On 2/6/07, ufuk kocolu <ufuk at pilli.com> wrote:
>   
>> I have a ror project which has been productized. There are several web
>> sites in one ror project
>>
>>     
>
> Question:
>
> A) You are serving multiple sites from one rails application?
>
> or
>
> B) You have multiple instances of your rails application, each one
> serving a specific web site.
>
>   
>> I need to set an "enviroment variable" to run different sites, can I do
>> that using mongrel? I tried to use mongrel's -S option and set the
>> enviroment variable in that file but it seems mongrel runs that file
>> after it calls enviroment.rb
>>     
>
> The answers will be:
>
> A) Use something like subdomain accounts:
>   http://wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys
>   http://www.bigbold.com/snippets/posts/show/1322
>
>
> B) process your ENV information inside environment, and set your
> environment variable prior calling mongrel_rails:
>
>   $ MY_SITE=site1 mongrel_rails start ...
>
>   or
>
>   $ export MY_SITE=site1
>   $ mongrel_rails start ...
>
>
>   

I have one rails application which runs severals sites according to that 
enviroment variable.

http://article.gmane.org/gmane.comp.lang.ruby.rails/14513

The problem is, I can do what you suggest but I want to use mongrel as 
an NT service  (I can create multiple NT services for multiple sites) 
for that, I have to set this enviroment variable elsewhere.

If there is an option to run system commands before mongrel service 
initializes, that would work for me.

Thanks

Ufuk













More information about the Mongrel-users mailing list