No commit activity in last 3 years
No release in over 3 years
Simple wrapper for YAML config files for Rails apps and gems
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

app_settings¶ ↑

Simple wrapper for YAML config files for Rails apps and gems

Install¶ ↑

sudo gem install ssoroka-app_settings
rake app_settings:install_config

Usage¶ ↑

Usage with Rails¶ ↑

in an initializer, put:

$settings = AppSettings.new(File.join(Rails.root, 'config', 'app_settings.yml'))

Then anywhere in your app you can access the settings with:

$settings['users/tim/user_name']
$settings['users/tim/password']

Or whatever applies for your config file.

See example_config/example_for_rails.yml for an example yml file, here’s some code examples to match:

$settings['google_maps_api_keys/localhost']

$settings['domains/legacy']

$settings['from_address']

$settings.from_address

Usage with Gems or Plugins¶ ↑

# if user_config_file_path doesn't exist, default_config_file_path will be used.
@settings = AppSettings.new(user_config_file_path, default_config_file_path)
@settings['hoptoad/auth_token']

ERB in config files¶ ↑

The config files support ERB: <%= %>

Copyright © 2009 Steven Soroka. See LICENSE for details.