Environment specific application configuration values

Hi, I'm using Google Maps API in my app and that requires a specific API key (a string) for each URI it is accessed from.

I'd like to put a specific key into each of the development.rb and production.rb files and pick up a default "localhost:3000" key from environment.rb and make that available somehow to print in a view.

What's the rails way to do this type of thing?

Many thanks,


Okay, so figured out that you add something like:

GOOGLE_MAPS_API_KEY = "somekeyvalue"

to the end each of the config/environments/*.rb files

and then call:


Pretty simple but how do I set a default value for all environments and then override for only those that require it? It seems that environment.rb overwrites the environments/*.rb files.

Thanks, -Tim

Tim Harding wrote: