0.0
No commit activity in last 3 years
No release in over 3 years
Easy config, Rails and Rack application's configuration made easy.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
>= 0
~> 2.9.0

Runtime

>= 0
 Project Readme

Easy config

Gem Version Build Status Code Climate Test Coverage Dependency Status

Rails and Rack applications configuration made easy.

Install

gem install easy_config

or in your Gemfile

gem "easy_config"

Usage

Rails/Sinatra

Inside config dir, create a file redis.yml:

development:
  host: 127.0.0.1
  port: 6379
  password:
production:
  host: 172.0.0.1
  port: 6379
  password: "alpha"

In your ruby code, you do:

  Redis.current = Redis.new({
    host: EasyConfig.redis.host,
    port: EasyConfig.redis.port,
    password: EasyConfig.redis.password
  })

Custom config paths

You can provide additional custom config paths.

Config file at vendor/config/sample.yml:

development:
  property: "value"

Code:

  EasyConfig.append_config_path Rails.root.join('vendor/config')
  puts EasyConfig.sample.property

Output will be: "value"

Environment Variables

  # ENV['APP_API_KEY'] = '1234567890'
  puts EasyConfig.app.api_key

How it works

EasyConfig allows you to access your config files easily. All you have to do is to put your files in config dir and be a valid YAML file (with .yml as extension).

If you desire you can split your configurations by environment. Easy config treats it automatically.

Supported rubies

  • 2.1
  • 2.0
  • 1.9.3
  • ree (will be dropped after 1.0)

License

The MIT License

Copyright (c) 2012-2014 Felipe Oliveira <http://felipecvo.github.io/>