Sha256: bdbbc350af7a7f0264e09c2dcd94fcc0c5050aa37381ac0456007944d062682a

Contents?: true

Size: 911 Bytes

Versions: 1

Compression:

Stored size: 911 Bytes

Contents

require 'shellwords'

module Aptible
  module CLI
    module Subcommands
      module Logs
        def self.included(thor)
          thor.class_eval do
            include Helpers::Operation
            include Helpers::App

            desc 'logs', 'Follows logs from a running app'
            option :app
            option :remote, aliases: '-r'
            def logs
              app = ensure_app(options)

              host = app.account.bastion_host
              port = app.account.dumptruck_port

              ENV['ACCESS_TOKEN'] = fetch_token
              ENV['APTIBLE_APP'] = app.handle
              ENV['APTIBLE_CLI_COMMAND'] = 'logs'

              opts = " -o 'SendEnv=*' -o StrictHostKeyChecking=no " \
                     '-o UserKnownHostsFile=/dev/null'
              Kernel.exec "ssh #{opts} -p #{port} root@#{host}"
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aptible-cli-0.5.8 lib/aptible/cli/subcommands/logs.rb