Skip to content

Instantly share code, notes, and snippets.

@Oshuma
Forked from henrik/init.rb
Created November 29, 2008 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oshuma/30161 to your computer and use it in GitHub Desktop.
Save Oshuma/30161 to your computer and use it in GitHub Desktop.
Simple Settings object for Merb.
Merb::BootLoader.before_app_loads do
# This will get executed after dependencies have been loaded but before your app's classes have loaded.
require 'config/settings'
end
# Copy this file to config/settings.rb, add real values and keep out of
# version control if it contains secrets or per-developer values.
require 'ostruct'
settings = {}
env = Merb.environment.to_sym rescue :development
# Any env
settings.default = {
:upload_dir => '/foo',
:password => 'test'
}
# Override (merge) for this env
settings[:production] = settings.default.merge({
:upload_dir => '/bar',
:password => 'sesame'
})
Settings = OpenStruct.new(settings[env])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment