[![Gem Version](https://badge.fury.io/rb/dsc.svg)](http://badge.fury.io/rb/dsc) [![Travis CI](https://api.travis-ci.org/wimdu/dsc.svg?branch=master)](https://travis-ci.org/wimdu/dsc) [![Code Climate](https://codeclimate.com/github/wimdu/dsc/badges/gpa.svg)](https://codeclimate.com/github/wimdu/dsc) # Dead simple configuration Read configuration from a YAML/JSON file and expose the keys as methods. ## Installation Add this line to your application's Gemfile: ```ruby gem 'dsc' ``` And then execute: $ bundle Or install it yourself as: $ gem install dsc ## Usage Create a config file (you can use ERB): ```yaml development: username: dev password: production: username: hugo password: secret pool: 42 url: <%= ENV["DATABASE_URL"] %> ``` Open the file and use it: ```ruby require 'dsc' database_config = Dsc.load_file('config/database.yml', env: 'production') database_config.username # => 'hugo' database_config.url # => 'adapter://hostname:4567/database' ``` That's it! ### Optional attributes If you want to be able to not specify some of the configuration options: ```ruby config = Dsc.load_file('config/config.yml', env: 'production', optional: [:pool, :password]) ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request