0.0
No commit activity in last 3 years
No release in over 3 years
An awesome app.yml gem for Rails. Supports App.settings.nested_setting syntax, all/production/staging/development/test environments, and auto-reloads app.yml changes without requiring an application restart.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 3.0
 Project Readme

app-yml-rails

This gem provides a Rails application with project-wide settings via an app.yml file. Settings can be accessed anywhere: controllers, helpers, views, models, tests, in the console, etc.

Features

  • Provides project-wide settings via config/app.yml.
  • Supports App.settings.nested_settings syntax.
  • Supports all/production/staging/development/test environments (specific environment settings over settings from the 'all' environment).
  • Auto-refreshes app.yml changes without requiring an application restart.

Installation

Add the following line to your project's Gemfile:

gem 'app-yml-rails'

Install the gem using Bundler:

$ bundle

Install the config and initializer files:

$ rails generate app_yml:install

Usage

  1. Edit your project settings in config/app.yml.
  2. Access settings anywhere in your application via App.settings.nested_setting syntax.

Examples

If your config/app.yml file appears as follows:

all:
  emails:
    admin: admin@example.com
    team:
      ceo: ceo@example.com
  max_search_results: 20
  app_name: My Amazing Application

development:
  emails:
    team:
      ceo: ceo@localhost
  app_name: My Amazing Application (development)

production:
  app_name: My Amazing Application (production)

Settings in the development environment:

App.emails.admin       => 'admin@example.com'
App.emails.team.ceo    => 'ceo@localhost'
App.max_search_results => 20
App.app_name           => 'My Amazing Application (development)'

Settings in the production environment:

App.emails.admin       => 'admin@example.com'
App.emails.team.ceo    => 'ceo@example.com'
App.max_search_results => 20
App.app_name           => 'My Amazing Application (production)'

License

MIT License