Gaston is a dead simple Ruby config store. Write your config in yaml files, and retrieve it through one Gaston.
Installation
Ruby 1.9.2 is required.
Install it with rubygems:
gem install gaston
With bundler, add it to your Gemfile:
gem "gaston"
Always specify environment in yaml :
Environment values are merged on :gaston values. :gaston is optional.
You can use erb inside values.
:gaston:
api:
state: "awesome"
:development:
api:
key: "api_key"
:test:
api:
key: <%= ENV["API_KEY"] %>
Since verion 0.2.0, gaston also accept json files.
Create an initializer. You can define an environment with the env method, and specify config files with the files method. Default env is :development.
Gaston.configure do |gaston|
gaston.env = Rails.env
gaston.files = Dir[Rails.root.join("config/gaston/**/*.yml")]
end
Querying a config key :
Gaston.api.state # => 'awesome'
Gaston.api.key # => 'api_key'