# Know environment active from command line

**URL:** <https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433>\
**Category:** Rails\
**Created:** [September 24, 2008, 8:54pm UTC](https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433 "2008-09-24T20:54:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [September 24, 2008, 8:54pm UTC](https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433/1 "2008-09-24T20:54:44Z")

</div>

I’m trying to deploy my application in a shared host but I get an  
error when running rake processes. Their IT tell me that perhaps I’m  
running the process in development mode and that’s why a get a DB  
connection error, but how can I know wich is the active environment?

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [September 24, 2008, 9:05pm UTC](https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433/2 "2008-09-24T21:05:17Z")

</div>

On Wed, Sep 24, 2008 at 11:44 AM, Abel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m trying to deploy my application in a shared host but I get an  
> error when running rake processes. Their IT tell me that perhaps I’m  
> running the process in development mode and that’s why a get a DB  
> connection error, but how can I know wich is the active environment?

Hi Abel, could you provide some details about your deployment? For  
example, how’s your environment.rb configured? Are you using Passenger?  
Please provide as much information that can allow us to assist you.

-Conrad

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [September 24, 2008, 9:16pm UTC](https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433/3 "2008-09-24T21:16:31Z")

</div>

I was just looking for a command line that shows wich is the active  
environment just to make sure, but now you ask I’m using Capistrano  
via a Gem developed by the hosting company, wich is called Brightbox.  
I suck at deployment and I always have this kind of problem so I just  
followed the guide they provide at their site and it’s my  
understanding that Capistrano would change the environment to  
production, but it doesn’t seem to be working.

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [September 24, 2008, 9:53pm UTC](https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433/4 "2008-09-24T21:53:11Z")

</div>

Try to run your rake task like this:

rake name:of:your:task RAILS\_ENV=production

On Wed, Sep 24, 2008 at 4:15 PM, Abel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > On Wed, Sep 24, 2008 at 11:44 AM, Abel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
> > -Conrad

–  
Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)  
João Pessoa, PB, +55 83 8867-7208

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [September 24, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433/5 "2008-09-24T21:59:41Z")

</div>

Thanks Mauricio,

I thought the default environment would be production. I wonder if  
there’s a way to change it permanently.

On Sep 24, 9:17 pm, “Maurício Linhares” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Abel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@Abel](https://www.ruby-forum.com/u/Abel)\
**Post date:** [September 24, 2008, 10:00pm UTC](https://www.ruby-forum.com/t/know-environment-active-from-command-line/149433/6 "2008-09-24T22:00:53Z")

</div>

Hi Abel,

The default environment is “development”, but you can set a default by  
setting the system variable RAILS\_ENV with the environment you want to  
have as the default.

On Wed, Sep 24, 2008 at 4:45 PM, Abel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > rake name:of:your:task RAILS\_ENV=production
> > 
> > > understanding that Capistrano would change the environment to
> > > 
> > > > Hi Abel, could you provide some details about your deployment? For  
> > > > example, how’s your environment.rb configured? Are you using Passenger?  
> > > > Please provide as much information that can allow us to assist you.
> > 
> > > > -Conrad
> > 
> > –  
> > Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) |[http://blog.codevader.com/(en)](http://blog.codevader.com/(en))  
> > João Pessoa, PB, +55 83 8867-7208

–  
Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)  
João Pessoa, PB, +55 83 8867-7208
