RConfig

The complete solution for Ruby Configuration Management


Project maintained by rahmal Hosted on GitHub Pages — Theme by mattgraham

Description

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.

features

Getting Started

Rails Apps

RConfig is released as a Ruby Gem. The gem is to be installed within a Ruby on Rails 3 application. To install, simply add the following to your Gemfile:

# Gemfile
gem 'rconfig'

After updating your bundle, run the installer

$> rails generate rconfig:install

The installer creates an initializer used for configuring defaults used by RConfig

Non-Rails Apps

If you're not using RConfig in a Rails app, and you don't use Gemfile you can install RConfig with RubyGems

gem install rconfig

Requirements

Starting with version 0.4.0, RConfig requires at least Ruby 1.9, and Rails 3. Previous versions can be used in Ruby 1.8 and Rails 2.2+. Non-rails projects need ActiveSupport (>= 3 for RConfig 0.4.0, and > 2.2 for RConfig 0.3).

Usage

shell/console =>
  export LANG=en

demo.yml =>
  server:
    address: host.domain.com
    port: 81
    host: <%= %x{host_name} %>
  ...

application.properties =>
  debug_level=verbose
  app_root=/home/rahmal/apps/rconfig
  test_root=%{app_root}/tests
  ...

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.demo.server.host     => 'host.local'

  RConfig.application.test_root => '/home/rahmal/apps/rconfig/tests'

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

Bugs and Feature Requests

Authors and Contributors

Thanks to everyone I included here. RConfig would not exist without their contributions.

Support or Contact

Having trouble with RConfig? Check out the documentation at or contact rahmal@gmail.com and I’ll help you sort it out. You can also checkout my homepage, and leave comments.