Module: ConsulWatcher
- Defined in:
- lib/consul_watcher.rb,
lib/consul_watcher/diff.rb,
lib/consul_watcher/filters.rb,
lib/consul_watcher/storage/disk.rb,
lib/consul_watcher/destination/jq.rb,
lib/consul_watcher/storage/consul.rb,
lib/consul_watcher/watch_type/key.rb,
lib/consul_watcher/destination/amqp.rb,
lib/consul_watcher/watch_type/checks.rb
Overview
This will be a module to store previous consul watch json to compare with previous watch data
Defined Under Namespace
Modules: Destination, Storage, WatchType Classes: Diff, Filters
Class Method Summary collapse
Class Method Details
.watch(config) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/consul_watcher.rb', line 11 def self.watch(config) dc = ENV['CONSUL_DC'] logger = Logger.new(STDOUT) logger.level = Logger::INFO assemble(config) current_watch_json = $stdin.read previous_watch_json = @storage.fetch changes = @watch_type.get_changes(previous_watch_json, current_watch_json, dc) changes.each do |change| @destination.send(change) end logger.info("Processed #{changes.size} change#{'s' unless changes.size == 1}") @storage.push(current_watch_json) end |