Module: Onair::Auth::HerokuCli

Defined in:
lib/onair/auth/heroku_cli.rb

Overview

Fallback when ~/.netrc yields nothing: boot the Heroku CLI. Slow (1-2s of Node startup) — that's why netrc is tried first.

Class Method Summary collapse

Class Method Details

.tokenObject



10
11
12
13
14
15
16
17
18
# File 'lib/onair/auth/heroku_cli.rb', line 10

def self.token
  stdout, _stderr, status = Open3.capture3("heroku", "auth:token")
  return nil unless status.success?

  token = stdout.strip
  token.empty? ? nil : token
rescue SystemCallError
  nil
end