Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set RAILS_ENV to production for all subsequent rake commands?

As a bonus how do I set this in a config, so that when I log into my production server I don't have to retype it.

like image 793
nasmorn Avatar asked Jun 24 '10 20:06

nasmorn


2 Answers

in your .bashrc, put:

if [[ $- != *i* ]] ; then
    # Shell is non-interactive.  Be done now!
    return
fi

export RAILS_ENV=production

Be careful, you will always be in production mode when you login !

like image 165
Nicolas Viennot Avatar answered Oct 05 '22 23:10

Nicolas Viennot


I tend to want to set it conscientiously with each command also.

Although I don't do much directly on the server, I'm usually using capistrano. So if I was working directly on the server a lot, I might want to set it permanently. Which, BTW, Larry didn't mention how to do:

$ RAILS_ENV=production
$ rake foo
$ rake bar
like image 35
John Bachir Avatar answered Oct 05 '22 22:10

John Bachir