How to set an Environment variable from command line

Hello,

I am looking to set a Variable from the command line during starting up
my server that will be accessible to the whole ruby on rails
application.

One way of setting such a config variable was putting defining it into
the environment.rb file but then I don’t know if I could override the
value of this variable in the environment.rb file when I start up my
server from the command line.

Thanks
Philip

Hi,

You can write this in environment file:

SOME_CONSTANT = ENV[“SOME_CONSTANT”] || “A DEFAULT VALUE”

then start rails by

SOME_CONSTANT=“42” script/server

or it will use default value.

Jan

On Thu, Jul 17, 2008 at 6:05 AM, Philip Varkey <
[email protected]> wrote:

server from the command line.

Thanks
Philip

Posted via http://www.ruby-forum.com/.


Fly on wheels.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs