Sha256: 7966b5d50bcb1c41ee165b387b9e021320df864a3b455824a7b2ceb2b487d154
Contents?: true
Size: 865 Bytes
Versions: 1
Compression:
Stored size: 865 Bytes
Contents
require 'envoy/client/trunk' require 'envoy/client/option_parser' require 'envoy/version' require 'yaml' def find_config dirs = Dir.pwd.split("/") r = dirs.reduce([]) do |m, x| [[*m[0], x], *m] end.map do |p| p.join("/") + "/.envoy" end.each do |p| return p if File.exist?(p) end false end def load_config if path = find_config conf = YAML.load(File.read(path)) conf.is_a?(Array) ? conf : [conf] else [{}] end end options = parse_options unless EM.reactor_running? EM.run do load_config.each do |config| config["local_port"] ||= rand(16383) + 49152 config = options.merge(config) config["hosts"] ||= [config.delete("host")] if config["host"] config = config.each_with_object({}) do |(k, v), h| h[k.to_sym] = v end Envoy::Client::Trunk.start p config end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
envoy-proxy-0.0.19 | lib/envoy/client/command.rb |