How to set environment specific config variables DRY-ly

Sorry, search is down on the forum, so I don’t know if this has been
posted elsewhere.

I have some config variables that I want to have set in all
environments, and overridden in production.

What I want to do is put this in my config/environment.rb

SOME_CONFIG = 555

And then override it in config/environments/production.rb as:

SOME_CONFIG = 333

Problem is, using constants I can’t redefine them, so it gives an error.

Any suggestions for a better solution? Copying the config var to all the
environments doesn’t seem very DRY. Maybe they shouldn’t be constants?

Thanks in advance!

Cameron

On 7/28/06, Cameron B. [email protected] wrote:

Problem is, using constants I can’t redefine them, so it gives an error.

irb warns me. See below:
irb(main):012:0> S=4
=> 4
irb(main):013:0> S=3
(irb):13: warning: already initialized constant S
=> 3
irb(main):014:0> S
=> 3

And warnings aren’t fatal.

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