File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -74,12 +74,12 @@ export class CloudAuth implements Authenticator {
74
74
const output = result . stdout . toString ( ) ;
75
75
const resultObj = JSON . parse ( output ) ;
76
76
77
- let tokenPathKey = config [ 'token-key' ] ;
77
+ const tokenPathKeyInConfig = config [ 'token-key' ] ;
78
+ const expiryPathKeyInConfig = config [ 'expiry-key' ] ;
78
79
79
- let expiryPathKey = config [ 'expiry-key' ] ;
80
80
// Format in file is {<query>}, so slice it out and add '$'
81
- tokenPathKey = '$' + tokenPathKey . slice ( 1 , - 1 ) ;
82
- expiryPathKey = '$' + expiryPathKey . slice ( 1 , - 1 ) ;
81
+ const tokenPathKey = '$' + tokenPathKeyInConfig . slice ( 1 , - 1 ) ;
82
+ const expiryPathKey = '$' + expiryPathKeyInConfig . slice ( 1 , - 1 ) ;
83
83
84
84
config [ 'access-token' ] = jsonpath . query ( resultObj , tokenPathKey ) ;
85
85
config . expiry = jsonpath . query ( resultObj , expiryPathKey ) ;
Original file line number Diff line number Diff line change @@ -643,6 +643,7 @@ describe('KubeConfig', () => {
643
643
'cmd-path' : 'echo' ,
644
644
'cmd-args' : `'${ responseStr } '` ,
645
645
'token-key' : '{.token.accessToken}' ,
646
+ 'expiry-key' : '{.token.token_expiry}' ,
646
647
} ,
647
648
} ,
648
649
} as User ) ;
@@ -666,6 +667,7 @@ describe('KubeConfig', () => {
666
667
'cmd-path' : 'echo' ,
667
668
'cmd-args' : `'${ responseStr } '` ,
668
669
'token-key' : '{.token.accessToken}' ,
670
+ 'expiry-key' : '{.token.token_expiry}' ,
669
671
} ,
670
672
} ,
671
673
} as User ) ;
@@ -689,6 +691,7 @@ describe('KubeConfig', () => {
689
691
'cmd-path' : 'echo' ,
690
692
'cmd-args' : `'${ responseStr } '` ,
691
693
'token-key' : '{.token.accessToken}' ,
694
+ 'expiry-key' : '{.token.token_expiry}' ,
692
695
} ,
693
696
} ,
694
697
} as User ) ;
You can’t perform that action at this time.
0 commit comments