Amberbit Config

Provides simple global configuration for Ruby on Rails application using YAML files.

Installation

$ ./script/plugin install git://github.com/amberbit/amberbit-config.git
$ rake amberbit:config:setup

Usage

Place your application configuration default values into #RAILS_ROOT/config/application/default.yml:

default:
  application:
    name: SuperApp
    url: http://localhost:3000/

test:
  # overwrite application.url key only in test env
  application:
    url: http://testhost:3000/

And overwrite values you wish on per-installation basis in #RAILS_ROOT/config/application/config.yml:

default:
  application:
    name: SuperApp specially for you

production:
  application:
    url: http://yoursuperhiperdomain.com

In your application Ruby code you can access the values in 2 following ways:

AppConfig['application']['name'] #=> SuperApp specially for you

or

AppConfig.application.name #=> SuperApp specially for you

Keys are deep-merged, for example:

production env:

AppConfig.application.name #=> SuperApp specially for you
AppConfig.application.url #=> http://yoursuperhiperdomain.com

development env:

AppConfig.application.name #=> SuperApp specially for you
AppConfig.application.url #=> http://localhost:3000/

Copyright © 2008/2009 Wojciech Piekutowski, released under the MIT license Copyright © 2009 Hubert Łępicki, released under the MIT license