Class: Emissary::Identity::Unix
Constant Summary
EXTERNAL_IDENTITY_GLOB, INTERNAL_IDENTITY_GLOB
Instance Attribute Summary
#loaded, #methods
Instance Method Summary
collapse
exclude, exclusions, #identifiers, #initialize, instance, #method_missing, new, register, #to_h, #to_s
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Emissary::Identity
Instance Method Details
#account_id ⇒ Object
43
44
45
|
# File 'lib/emissary/identity/unix.rb', line 43
def account_id
ENV['ACCOUNT_ID'] || -1
end
|
#cluster_id ⇒ Object
39
40
41
|
# File 'lib/emissary/identity/unix.rb', line 39
def cluster_id
ENV['CLUSTER_ID'] || -1
end
|
#instance_id ⇒ Object
31
32
33
|
# File 'lib/emissary/identity/unix.rb', line 31
def instance_id
ENV['INSTANCE_ID'] || -1
end
|
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/emissary/identity/unix.rb', line 47
def local_ip
@ip_local ||= begin
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
@ip_local = UDPSocket.open { |s| s.connect IP_CHECK_DOMAIN, 1; s.addr.last }
rescue
nil
ensure
Socket.do_not_reverse_lookup = orig rescue nil
end
end
|
#name ⇒ Object
Also known as:
queue_name
21
22
23
|
# File 'lib/emissary/identity/unix.rb', line 21
def name
@hostname ||= `uname -n`.strip
end
|
#public_ip ⇒ Object
59
60
61
62
63
64
65
|
# File 'lib/emissary/identity/unix.rb', line 59
def public_ip
@ip_public ||= begin
Net::HTTP.get(URI.parse(IP_CHECK_URL)).gsub(/.*?((\d{1,3}\.){3}\d{1,3}).*/m, '\1')
rescue
nil
end
end
|
27
28
29
|
# File 'lib/emissary/identity/unix.rb', line 27
def roles
ENV['ROLES'] || ''
end
|
#server_id ⇒ Object
35
36
37
|
# File 'lib/emissary/identity/unix.rb', line 35
def server_id
ENV['SERVER_ID'] || -1
end
|