Skip to content

Commit

Permalink
Merge pull request #24 from mh377/fix_vault_client_issue
Browse files Browse the repository at this point in the history
fix vault client issue
  • Loading branch information
b1ff authored Jun 22, 2022
2 parents 1a917aa + d9ee095 commit da16cf4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/VaultClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class VaultClient {
return vaultConf.populate();
}

getHeaders() {
getHeaders(token) {
if (this.__namespace) {
return {
'X-Vault-Token': token.getId(),
Expand All @@ -184,7 +184,7 @@ class VaultClient {
read(path) {
this.__log.debug('read secret %s', path);
return this.__auth.getAuthToken()
.then(token => this.__api.makeRequest('GET', path, null, this.getHeaders()))
.then(token => this.__api.makeRequest('GET', path, null, this.getHeaders(token)))
.then(res => {
this.__log.debug('receive secret %s', path);
return Lease.fromResponse(res);
Expand All @@ -204,7 +204,7 @@ class VaultClient {
list(path) {
this.__log.debug('list secrets %s', path);
return this.__auth.getAuthToken()
.then(token => this.__api.makeRequest('LIST', path, null, this.getHeaders()))
.then(token => this.__api.makeRequest('LIST', path, null, this.getHeaders(token)))
.then(res => {
this.__log.debug('got secrets list %s', path);
return Lease.fromResponse(res);
Expand All @@ -225,7 +225,7 @@ class VaultClient {
write(path, data) {
this.__log.debug('write secret %s', path);
return this.__auth.getAuthToken()
.then((token) => this.__api.makeRequest('POST', path, data, this.getHeaders()))
.then((token) => this.__api.makeRequest('POST', path, data, this.getHeaders(token)))
.then((response) => {
this.__log.debug('secret %s was written', path);
return response;
Expand Down

0 comments on commit da16cf4

Please sign in to comment.