Browse files

Clean up merge

  • Loading branch information...
1 parent d897bab commit 218aa2c31dbf2447065cdff1dcf5182878a70489 @decklin decklin committed May 3, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 lib/sensu-handler.rb
View
17 lib/sensu-handler.rb
@@ -3,13 +3,6 @@
module Sensu
- CONFIG_FILES = case
- when ENV['SENSU_CONFIG_FILES']
- ENV['SENSU_CONFIG_FILES'].split(':')
- else
- ['/etc/sensu/config.json'] + Dir['/etc/sensu/conf.d/**/*.json']
- end
-
NET_HTTP_REQ_CLASS = {
'GET' => Net::HTTP::Get,
'POST' => Net::HTTP::Post,
@@ -46,12 +39,20 @@ def method_added(name)
end
end
+ def config_files
+ if ENV['SENSU_CONFIG_FILES']
+ ENV['SENSU_CONFIG_FILES'].split(':')
+ else
+ ['/etc/sensu/config.json'] + Dir['/etc/sensu/conf.d/*.json']
+ end
+ end
+
def load_config(filename)
JSON.parse(File.open(filename, 'r').read) rescue Hash.new
end
def settings
- @settings ||= CONFIG_FILES.map { |f| load_config(f) }.reduce { |a, b| a.deep_merge(b) }
+ @settings ||= config_files.map {|f| load_config(f) }.reduce {|a, b| a.deep_merge(b) }
end
def read_event(file)

0 comments on commit 218aa2c

Please sign in to comment.