Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hayesgm/qonf
A Simple Rails Configuration Management Gem
https://github.com/hayesgm/qonf
Last synced: about 1 month ago
JSON representation
A Simple Rails Configuration Management Gem
- Host: GitHub
- URL: https://github.com/hayesgm/qonf
- Owner: hayesgm
- License: mit
- Created: 2014-06-22T20:41:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-22T00:55:49.000Z (about 10 years ago)
- Last Synced: 2024-04-15T14:02:00.895Z (7 months ago)
- Language: Ruby
- Size: 172 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Qonf
Versitle configuration management. Pull data from ENV or config files. Simplest use case:
## Usage
Qonf works well with or without Rails. If using Rails, Qonf will assume config files are in `Rails.root/config` directory. Otherwise, you'll need to set the root yourself:
Qonf.configure do
self.base_dir = "./config"
endQonf also allows you to use environment based keys, these will come preconfigured for Rails or could be set by other ruby applications:
Qonf.configure do
self.env = "staging" # hash under this key will be merged into top-level hash
self.environments = %w{test staging production} # these will be removed from hash if they are top-level keys
endSo, if you config is as follows:
# config/names.json
{
"test": {
"name": "Test data"
},
"staging": {
"name": "Bob Jones"
}
}Qonf.get(:names,:name) # Bob Jones
## Config Files
Config files can be either json or yml. They are addressed by name and must live in the `base_dir` path (for Rails, this is `Rails.root/config`)
# config/qonf.json
{
"host": "http://google.com"
}Qonf.host # "http://google.com"
YAML can also be used:
# config/redis.yml
development:
host: localhostQonf.get(:redis,:host) # "localhost"
## Installation
Add this line to your application's Gemfile:
gem 'qonf'
And then execute:
$ bundle
Or install it yourself as:
$ gem install qonf
## Testing
Tests are maintained by RSpec. To run test cases:
bundle exec rake test
## 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 new Pull Request