Module: Avm::Instances::Base::AutoValues::Access

Defined in:
lib/avm/instances/base/auto_values/access.rb

Instance Method Summary collapse

Instance Method Details

#auto_accessObject



8
9
10
# File 'lib/avm/instances/base/auto_values/access.rb', line 8

def auto_access
  read_entry_optional('ssh.url').present? ? 'ssh' : 'local'
end

#auto_ssh_hostnameObject



12
13
14
# File 'lib/avm/instances/base/auto_values/access.rb', line 12

def auto_ssh_hostname
  inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.hostname')
end

#auto_ssh_portObject



16
17
18
# File 'lib/avm/instances/base/auto_values/access.rb', line 16

def auto_ssh_port
  inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.port') || 22
end

#auto_ssh_urlObject



24
25
26
27
# File 'lib/avm/instances/base/auto_values/access.rb', line 24

def auto_ssh_url
  inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.url') ||
    auto_ssh_url_by_parts
end

#auto_ssh_url_by_partsObject



29
30
31
32
33
34
35
# File 'lib/avm/instances/base/auto_values/access.rb', line 29

def auto_ssh_url_by_parts
  read_entry_optional('ssh.hostname').if_present do |a|
    a = read_entry_optional('ssh.username').if_present(a) { |v| "#{v}@#{a}" }
    a = read_entry_optional('ssh.port').if_present(a) { |v| "#{a}:#{v}" }
    "ssh://#{a}"
  end
end

#auto_ssh_usernameObject



20
21
22
# File 'lib/avm/instances/base/auto_values/access.rb', line 20

def auto_ssh_username
  inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.username')
end