Setting RAILS_ENV before running script/server in the comma

I want to set an environment variable before running a script

for example setting

ENV[‘RAILS_ENV’] = production

in the command line before running script/server so that it would
start in production mode.

Is there a way to do this from the command line so that I don’t have
to modify the file?

Thanks,

Brian

Hi !

2006/2/10, Brian L. [email protected]:

ENV[‘RAILS_ENV’] = production

If that is all you want to do, script/server has an option to do just
that:

script/server -e production

On the other hand, if you want to set other environment variables, you
might want to create a launcher script:

#!/bin/sh
export SOME_VAR=123
export VAR2=/var/db/root

cd /var/www/app1
script/server -e production

If you’re on Windows, the same can be done, albeit slightly differently.

Hope that helps !