Skip to content

Instantly share code, notes, and snippets.

@Oshuma
Created November 29, 2008 15:59
Show Gist options
  • Save Oshuma/30253 to your computer and use it in GitHub Desktop.
Save Oshuma/30253 to your computer and use it in GitHub Desktop.
Super simple Merb configuration.
# config/app_config.yml
# Keep this out of version control if you have sensitive information!!
defaults: &defaults
name: Super Awesome Blog
tagline: My super awesome blog and stuff.
email: you@example.org
development:
<<: *defaults
# Override the defaults.
test:
<<: *defaults
# Override the defaults.
production:
<<: *defaults
# Override the defaults.
tagline: My super awesome blog, in production!
# config/init.rb
Merb::BootLoader.after_app_loads do
# This will get executed after your app's classes have been loaded.
begin
config_file = File.expand_path(Merb.root + '/config/app_config.yml')
AppConfig = Mash.new(YAML.load_file(config_file)[Merb.env]) unless defined? AppConfig
rescue => error
puts 'AppConfig could not be loaded!'
puts error
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment