forked from shilesh/app_config
-
Notifications
You must be signed in to change notification settings - Fork 0
Loading application specific constants
License
shileshv2/app_config
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
AppConfig ========= Summary: ======= This plugin helps to load values from a config file(yml) file based on the environment, with out writing extra code. ie: if you have a config file as 'app_config.yml' and has values in it as title: 'Caption'.The plugin helps you to call as "AppConfig::TITLE". If your config file name is 'ror_values.yml' then the values can be accessed as RorValue::TITLE". In short <FileName>::<key in caps>. I have tested against ruby 1.9 and rails 3.0 How to use: ========== Install the plugin. This will create a folder 'app_config' inside 'config' folder of your rails application. A mock config file, named 'app_config.yml', will be created with sample data. User can edit the file with proper values. The file name can be renamed Based on the file name the namescope will be created to access the values( <FileName>::<KEY> ). Restart the server if you change the file name. You can expect helpfull error messages being raised on invalid access. When you uninstall the files in config/app_config/* will be retained, expecting that it would contain usefull data. You can manually delete it if needed. http://shyleshkumar.blogspot.com/2011/05/plugin-for-loading-application.html Example ======= config/app_config/app_config.yml development: admin_mail: [email protected] thirdparty_api: dev.sample.com production: admin_mail: [email protected] thirdparty_api: sample.com from the application you can access the values(based on environment) as <FileName>::<key in caps> ex: AppConfig::ADMIN_MAIL some of the common warnings are pasted here: ************************** AppConfig : WARNING ****************************** ** Can not load values from config file ** <path>/config/app_config/app_constants.yml is missing ***************************************************************************** ********** AppConfig : ERROR **************** ** Error reading <some path>/config/app_config/app_config.yml ** syntax error on line 2, col 1: ` admin_email: '[email protected]'' ********************************************* Copyright (c) 2011 [shilesh], released under the MIT license
About
Loading application specific constants
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published