https://github.com/atomicobject/environment_configurable
A library that makes environment dependent configuration easy in Rails.
https://github.com/atomicobject/environment_configurable
Last synced: 10 months ago
JSON representation
A library that makes environment dependent configuration easy in Rails.
- Host: GitHub
- URL: https://github.com/atomicobject/environment_configurable
- Owner: atomicobject
- License: mit
- Created: 2010-03-15T12:41:39.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2011-01-13T00:10:02.000Z (over 15 years ago)
- Last Synced: 2025-06-04T12:17:44.825Z (11 months ago)
- Language: Ruby
- Homepage: http://www.atomicobject.com/pages/Software+Commons
- Size: 184 KB
- Stars: 2
- Watchers: 25
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# environment_configurable
Description
===========
A library that makes environment dependent configuration easy in rails.
Rationale
========
Environment dependent configuration is a common problem in rails, and we noticed
a common pattern:
* We tend to extract configuration variables to a yaml file
* We often wrap the yaml configuration in a configuration helper
Environment Configurable accomplishes both of these task succinctly.
Install
====
* gem install environment_configurable
* Add config.gem "environment_configurable" to your environment.rb file
Dependencies
============
* Rails 2.3.0 >=
Example
=======
class S3Helper
include EnvironmentConfigurable
configure_with "config/s3.yml"
def self.connect!
AWS::S3::Base.establish_connection!(
:access_key_id => config.access_key_id,
:secret_access_key => config.secret_access_key
)
end
end
s3.yml
production: &DEFAULTS
access_key_id: ACCESS_KEY_ID
secret_access_key: SECRET_ACCESS_KEY
bucket: the-prod-bucket
staging:
<<: *DEFAULTS
bucket: the-staging-bucket
development:
<<: *DEFAULTS
bucket: the-development-bucket
test:
<<: *DEFAULTS
bucket: the-test-bucket
Authors
=======
* Justin DeWind (dewind@atomicobject.com)
* David Crosby (crosby@atomicobject.com)
* © 2009-2011 [Atomic Object](http://www.atomicobject.com/)
* More Atomic Object [open source](http://www.atomicobject.com/pages/Software+Commons) projects