class Kafkat::Config
Constants
- CONFIG_PATHS
Attributes
json_files_path[R]
kafka_path[R]
log_path[R]
zk_path[R]
Public Class Methods
load!()
click to toggle source
# File lib/kafkat/config.rb, line 16 def self.load! string = nil e = nil CONFIG_PATHS.each do |rel_path| begin path = File.expand_path(rel_path) string = File.read(path) break rescue => e end end raise e if e && string.nil? json = JSON.parse(string) self.new(json) rescue Errno::ENOENT raise NotFoundError rescue JSON::JSONError raise ParseError end
new(json)
click to toggle source
# File lib/kafkat/config.rb, line 40 def initialize(json) @kafka_path = json['kafka_path'] @log_path = json['log_path'] @zk_path = json['zk_path'] @json_files_path = json['json_files_path'] if !@json_files_path || !File.exist?(@json_files_path) raise ArgumentError, "The directory \"json_files_path\": \"#{@json_files_path}\" does not exit." end end