-
-
Save Oshuma/30161 to your computer and use it in GitHub Desktop.
Simple Settings object for Merb.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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