File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export class APIClient {
41
41
preauthPromises : { [ k : string ] : Promise < HTTP > }
42
42
http : typeof HTTP
43
43
private _twoFactorMutex : Mutex < string > | undefined
44
+ private _auth ?: string
44
45
45
46
constructor ( protected config : Config . IConfig , public options : IOptions = { } ) {
46
47
this . config = config
@@ -110,13 +111,16 @@ export class APIClient {
110
111
}
111
112
112
113
get auth ( ) : string | undefined {
113
- if ( process . env . HEROKU_API_TOKEN ) deps . cli . warn ( 'HEROKU_API_TOKEN is set but you probably meant HEROKU_API_KEY' )
114
- let auth = process . env . HEROKU_API_KEY
115
- if ( ! auth ) {
116
- deps . netrc . loadSync ( )
117
- auth = deps . netrc . machines [ vars . apiHost ] && deps . netrc . machines [ vars . apiHost ] . password
114
+ if ( ! this . _auth ) {
115
+ this . _auth = process . env . HEROKU_API_KEY
116
+ if ( this . _auth ) {
117
+ deps . cli . warn ( 'HEROKU_API_TOKEN is set but you probably meant HEROKU_API_KEY' )
118
+ } else {
119
+ deps . netrc . loadSync ( )
120
+ this . _auth = deps . netrc . machines [ vars . apiHost ] && deps . netrc . machines [ vars . apiHost ] . password
121
+ }
118
122
}
119
- return auth
123
+ return this . _auth
120
124
}
121
125
122
126
twoFactorPrompt ( ) {
You can’t perform that action at this time.
0 commit comments