class Explorer::CLI::Proxy

Public Instance Methods

add(domain, host, port) click to toggle source
# File lib/explorer/cli/proxy.rb, line 26
def add(domain, host, port)
  Celluloid.logger = nil # Silence celluloid

  ipc = IPCClient.new
  ipc.hostmap_add(domain, host, port)
  puts "Added #{domain} to proxy"
rescue Errno::ENOENT
  puts Rainbow('Explore is not running').color(:red).bright
end
list() click to toggle source
# File lib/explorer/cli/proxy.rb, line 9
def list
  Celluloid.logger = nil # Silence celluloid

  ipc = IPCClient.new
  data = ipc.hostmap_list.map do |k, v|
    {
      domain: "[yellow]#{k}[/]",
      host: "[yellow]#{v['host']}[/]",
      port: "[yellow]#{v['port']}[/]",
    }
  end
  Formatador.display_compact_table(data, [:domain, :host, :port])
rescue Errno::ENOENT
  puts Rainbow('Explore is not running').color(:red).bright
end
remove(domain) click to toggle source
# File lib/explorer/cli/proxy.rb, line 37
def remove(domain)
  Celluloid.logger = nil # Silence celluloid

  ipc = IPCClient.new
  ipc.hostmap_remove(domain)
  puts "Removed #{domain} from proxy"
rescue Errno::ENOENT
  puts Rainbow('Explore is not running').color(:red).bright
end