lian / env-conf

A better way to use the ENV for configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

env-conf

Provides a better way to configure the application than simply pulling strings from ENV by overriding the deprecated Config class.

Features

defaults

Config[:foo]
# => nil

Config.default(:foo, 'bar')
Config[:foo]
# => 'bar'
Config['FOO']
# => 'bar'

type casts

Returns nil when undefined, otherwise casts to indicated type.

int

Config.int(:max_connections)
#=> 10

Installation

Add this line to your application's Gemfile:

gem 'env-conf'

And then execute:

$ bundle

Or install it yourself as:

$ gem install env-conf

Usage

require 'env-conf'

Config[:foo]

Contributing

  1. Fork it ( https://github.com/[my-github-username]/env-conf/fork )
  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

About

A better way to use the ENV for configuration

License:MIT License


Languages

Language:Ruby 100.0%