Last Modified
2012-05-02 23:08:52 -0700
Requires
  • active_support
  • active_support/hash_with_indifferent_access
  • rconfig/core_ext/array
  • rconfig/core_ext/hash
  • rconfig/core_ext/nil

Description

Copyright © 2009 Rahmal Conda


The complete solution for Ruby Configuration Management. RConfig is a Ruby library that manages configuration within Ruby applications. It bridges the gap between yaml, xml, and key/value based properties files, by providing a centralized solution to handle application configuration from one location. It provides the simplicity of hash-based access, that Rubyists have come to know and love, supporting your configuration style of choice, while providing many new features, and an elegant API.



 The overlay order of the config files is defined by SUFFIXES:
 * nil
 * _local
 * _config
 * _local_config
 * _{environment} (.i.e _development)
 * _{environment}_local (.i.e _development_local)
 * _{hostname} (.i.e _whiskey)
 * _{hostname}_config_local (.i.e _whiskey_config_local)

Example:

 shell/console =>
   export LANG=en

 demo.yml =>
  server:
    address: host.domain.com
    port: 81
 ...

 application.properties =>
   debug_level = verbose
 ...

demo.rb =>

 require 'rconfig'
 RConfig.load_paths = ['$HOME/config', '#{APP_ROOT}/config', '/demo/conf']
 RConfig.demo[:server][:port] => 81
 RConfig.demo.server.address  => 'host.domain.com'

 RConfig[:debug_level] => 'verbose'
 RConfig[:lang] => 'en'
 ...