Sha256: ceaf195028387402a48afd5b54608789f2988e0576d32a14e3a20fa1c966b1fd

Contents?: true

Size: 1.02 KB

Versions: 72

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Avm
  module Instances
    class Base
      module AutoValues
        module Access
          def auto_access
            read_entry_optional('ssh.url').present? ? 'ssh' : 'local'
          end

          def auto_ssh_hostname
            inherited_entry_value(:host_id, 'ssh.hostname')
          end

          def auto_ssh_port
            inherited_entry_value(:host_id, 'ssh.port') || 22
          end

          def auto_ssh_username
            inherited_entry_value(:host_id, 'ssh.username')
          end

          def auto_ssh_url
            inherited_entry_value(:host_id, 'ssh.url') || auto_ssh_url_by_parts
          end

          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
        end
      end
    end
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
avm-tools-0.71.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.70.2 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.70.1 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.70.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.69.3 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.69.2 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.69.1 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.69.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.68.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.67.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.66.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.65.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.64.2 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.64.1 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.64.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.63.0 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.62.4 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.62.3 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.62.2 lib/avm/instances/base/auto_values/access.rb
avm-tools-0.62.1 lib/avm/instances/base/auto_values/access.rb