New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

config-parser

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-parser

  • 0.4.2
  • Rubygems
  • Socket score

Version published
Maintainers
3
Created
Source

Build Status

Ruby Config Parser

Providing config values for your Ruby app with convenience methods like overwriting variables per Rails environment and overwriting variables with a local options_local.yml file.

Installation

The best way to install is with RubyGems:

$ gem install config-parser

Or better still, just add it to your Gemfile:

gem 'config-parser'

Defaults

Per default the parser will search for the config file at config/options.yml and local overrides at config/options-local.yml.

Example

Example config file:

default:
  supported_languages: en
  mailer_delivery_method: local

production:
  mailer_delivery_method: smtp

When running in the production environment, the mailer_delivery_method will be set to 'smtp'. The same works for all other environments. The optional options_local.yml file would have the same layout.

The precedence of config values goes like this (from lowest to highest):

options.yml default section -> options.yml environment section -> options-local.yml default section -> options-local.yml environment section

When used from a Rails app, just include in your application.rb:

OPTS = Common::Options.new

and you can use the config variables like:

OPTS.<variable_name>
OPTS.<variable_name>[:nested_value]

Also, you can pass main config and local config location as well as environment to load That allows you to use config-parser outside Rails env.

OPTS = Common::Options.new('path/to/options.yml', 'path/to/options-local.yml', :development)

FAQs

Package last updated on 22 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc