Sha256: 5bee26bd8b3f27cbc63d035720f3eb415754f6d271a69ee56cac30a03f269627

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

require 'envoy/server/trunk'
require 'envoy/server/web'
require 'envoy/version'
require 'optparse'

listen = ["0.0.0.0", "8080"]
key = nil

OptionParser.new do |op|
  op.banner = "Usage: #{$0} [options] ZONE"
  op.on "-l", "--listen ADDRESS", "Listen on this [host:]port for HTTP" do |v|
    port, host = v.split(":").reverse
    listen = [host || "0.0.0", port]
  end
  op.on "-k", "--key KEY", "Require authentication using KEY" do |v|
    key = v
  end
  op.on "--version" do
    puts Envoy::VERSION
    exit
  end
  op.parse!
  op.abort "zone required" unless ARGV[0]
end

$zone = ARGV[0].gsub(/^\.+/, '')

unless EM.reactor_running?
  EM.run do
    Envoy.verbosity = Envoy::FATAL
    EM.start_server "0.0.0.0", 8282, Envoy::Server::Trunk, key
    EM.start_server *listen, Envoy::Server::Web
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
envoy-proxy-1.0.3 lib/envoy/server/command.rb
envoy-proxy-1.0.1 lib/envoy/server/command.rb
envoy-proxy-1.0.0 lib/envoy/server/command.rb