Sha256: c3a7db8f7e7f71f6c2448520d8ee77b5ee477d1147fd9524bf5fc50e8bf43356

Contents?: true

Size: 999 Bytes

Versions: 9

Compression:

Stored size: 999 Bytes

Contents

#!/usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])

require 'optparse'
require 'proxymachine'

begin
  options = {:host => "0.0.0.0", :port => 5432}

  opts = OptionParser.new do |opts|
    opts.banner = <<-EOF
  Usage:
    proxymachine -c <config file> [-h <host>] [-p <port>]

  Options:
EOF

    opts.on("-cCONFIG", "--config CONFIG", "Configuration file") do |x|
      options[:config] = x
    end

    opts.on("-hHOST", "--host HOST", "Hostname to bind. Default 0.0.0.0") do |x|
      options[:host] = x
    end

    opts.on("-pPORT", "--port PORT", "Port to listen on. Default 5432") do |x|
      options[:port] = x
    end
  end

  opts.parse!

  load(options[:config])
  name = options[:config].split('/').last.chomp('.rb')
  ProxyMachine.run(name, options[:host], options[:port])
rescue Exception => e
  if e.instance_of?(SystemExit)
    raise
  else
    LOGGER.info 'Uncaught exception'
    LOGGER.info e.message
    LOGGER.info e.backtrace.join("\n")
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
proxymachine-1.2.4 bin/proxymachine
proxymachine-1.2.3 bin/proxymachine
proxymachine-1.2.2 bin/proxymachine
proxymachine-1.2.1 bin/proxymachine
proxymachine-1.2.0 bin/proxymachine
fizx-proxymachine-1.2.0 bin/proxymachine
proxymachine-1.1.0 bin/proxymachine
proxymachine-1.0.0 bin/proxymachine
proxymachine-0.2.8 bin/proxymachine