Permalink
Browse files

Merge pull request #20

  • Loading branch information...
2 parents 5982ff7 + 23b4415 commit bb63266a3f46c5e3207e79559afdbd265b206b67 @decklin decklin committed May 4, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/sensu-handler.rb
View
@@ -37,17 +37,20 @@ def method_added(name)
end
end
- # Unfortunately, we need to reimplement config loading. I'm not sure there's
- # a good way to allow overriding these paths.
-
- CONFIGS = ['/etc/sensu/config.json'] + Dir['/etc/sensu/conf.d/*.json']
+ 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 ||= CONFIGS.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 bb63266

Please sign in to comment.