Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Commit

Permalink
Simplify Scriptum::Config
Browse files Browse the repository at this point in the history
  • Loading branch information
drewreeve committed Jan 18, 2013
1 parent d620db9 commit 622cf0b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/configuration.rb
Expand Up @@ -5,17 +5,13 @@ module Config

def self.[](key)
unless @config
root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

@config = begin
YAML.load(File.read(root+"/config/settings.yml"))[ENV['RACK_ENV']||'development']
rescue Errno::ENOENT
YAML.load(File.read(root+"/config/settings.default.yml"))[ENV['RACK_ENV']||'development']
end
root = File.expand_path('..', File.dirname(__FILE__))
environment = ENV['RACK_ENV'] || 'development'
@config = YAML.load(File.read(root + '/config/settings.yml'))[environment]
end

@config[key.to_s]
end

end
end
end

0 comments on commit 622cf0b

Please sign in to comment.