Konfiguration
Konfiguration makes it easy to load YAML-formatted configuration files.
Installation
Add this line to your application's Gemfile:
gem 'konfiguration'
And then execute:
$ bundle
Or install it yourself as:
$ gem install konfiguration
Usage
The system looks for two external pieces of information in order to function:
$app_path
must be set to the expanded path of the root of the app.ENV['env']
is the current environment, e.g.,live
,dev
, etc. (Defaults todev
).
The configuration system is based on several environment-specfic YAML files, in
the app's config
subdirectory.
The directory structure looks like this:
config
/dev
/a-file-here-will-override-the-shared-version.yml
/live
/the-environment-is-pulled-from-the-kenji-env.yml
/shared
/a-file-that-is-shared-across-env.yml
Configuration can be fetched like this:
Konfiguration.foo :bar, :baz
In this case, it will fetch the configuration file foo.yml
, and drill down
within that file to the key bar.baz
.
Contributing
- Fork it ( https://github.com/kballenegger/konfiguration/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request