mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
- refactor configs (all inherit from BaseConfig) - move beef of agent code to lib/net/clients/ - use optionparser's ".order" instead of ".parse"
22 lines
622 B
Ruby
22 lines
622 B
Ruby
require 'yaml'
|
|
|
|
module LogStash; module Config
|
|
# Base config class. All configs need to know how to get to a broker.
|
|
class BaseConfig
|
|
attr_reader :mqhost
|
|
attr_reader :mqport
|
|
attr_reader :mquser
|
|
attr_reader :mqpass
|
|
attr_reader :mqvhost
|
|
|
|
def initialize(file)
|
|
obj = YAML::load(File.open(file).read())
|
|
|
|
@mqhost = obj["mqhost"] || "localhost"
|
|
@mqport = obj["mqport"] || 5672
|
|
@mquser = obj["mquser"] || "guest"
|
|
@mqpass = obj["mqpass"] || "guest"
|
|
@mqvhost = obj["mqvhost"] || "/"
|
|
end # def initialize
|
|
end # class BaseConfig
|
|
end; end # module LogStash::Config
|