Class: CashServer

Inherits:
Server show all
Defined in:
lib/proboscis_cli.rb

Class Method Summary collapse

Class Method Details

.ip(auth_code, host, environment, subdomain, type, subpath) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/proboscis_cli.rb', line 33

def self.ip(auth_code, host, environment, subdomain, type, subpath)
  super
  if subpath == 'araneae'
    return @ipAddress
  end
  res = HTTParty.get("https://#{subdomain}.delium.io/api/admin/hosts", headers: {'X-Auth-Key': self.param(environment, 'token')})
  if res.code != 200
    puts "Failed to get subpath details. #{res.code}"
    exit -1
  end
  subservers = JSON::parse(res.body)
  @ipAddress = subservers.select {|s| s['name'] == subpath}[0]['host']
  @ipAddress
end

.param(environment, lookup) ⇒ Object



29
30
31
# File 'lib/proboscis_cli.rb', line 29

def self.param(environment, lookup)
  ENV["araneae_#{environment}_#{lookup}"]
end

.port(environment, type, subpath) ⇒ Object



25
26
27
# File 'lib/proboscis_cli.rb', line 25

def self.port(environment, type, subpath)
  subpath == 'araneae' ? "1729" : "22"
end