Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gluons/mysticonfig
🔮 The configuration loader for wizard.
https://github.com/gluons/mysticonfig
config config-loader configuration configuration-loader json rc yaml
Last synced: about 2 months ago
JSON representation
🔮 The configuration loader for wizard.
- Host: GitHub
- URL: https://github.com/gluons/mysticonfig
- Owner: gluons
- License: mit
- Created: 2018-01-01T07:01:25.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T10:06:10.000Z (over 6 years ago)
- Last Synced: 2024-04-14T04:49:01.412Z (9 months ago)
- Topics: config, config-loader, configuration, configuration-loader, json, rc, yaml
- Language: Ruby
- Homepage: https://git.io/mysticonfig
- Size: 713 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mysticonfig
[![license](https://img.shields.io/github/license/gluons/mysticonfig.svg?style=flat-square)](./LICENSE)
[![Gem](https://img.shields.io/gem/v/mysticonfig.svg?style=flat-square)](https://rubygems.org/gems/mysticonfig)
[![Gem](https://img.shields.io/gem/dt/mysticonfig.svg?style=flat-square)](https://rubygems.org/gems/mysticonfig)
[![Libraries.io for GitHub](https://img.shields.io/librariesio/github/gluons/mysticonfig.svg?style=flat-square)](https://libraries.io/github/gluons/mysticonfig)
[![Travis](https://img.shields.io/travis/gluons/mysticonfig.svg?style=flat-square)](https://travis-ci.org/gluons/mysticonfig)
🔮 The configuration loader for wizard.
A library to load `.appnamerc`, `.appnamerc.json` or `.appnamerc.yaml` config file easily.
`mysticonfig` will lookup for your config file.
It keeps traversing up until it **finds the config file** or **reaches your home directory**.> Gem's name inspired by [cosmiconfig](https://github.com/davidtheclark/cosmiconfig)
## Installation
```bash
gem install mysticonfig
```## Usage
### Normal
```ruby
require 'mysticonfig'loader = Mysticonfig::Loader.new 'appname'
config = loader.load # Automatically detect and load config
json_config = loader.load_json # Only load config from JSON file
yaml_config = loader.load_yaml # Only load config from YAML file (.yaml or .yml)
```### With default config fallback
```ruby
require 'mysticonfig'DEFAULT_CONFIG = {
'a' => 'A',
'b' => 'B',
'c' => 'C'
}loader = Mysticonfig::Loader.new('appname', DEFAULT_CONFIG)
config = loader.load # Automatically detect and load config
json_config = loader.load_json # Only load config from JSON file
yaml_config = loader.load_yaml # Only load config from YAML file (.yaml or .yml)
```## Documentation
See https://gluons.github.io/mysticonfig/