Skip to content

Commit 82a9a6e

Browse files
authored
Merge pull request #11 from bcgov/fix/vaultUrl
fix: default vault url
2 parents cd75977 + 7d317aa commit 82a9a6e

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nr-objectstore-rotate",
3-
"version": "1.1.4",
3+
"version": "1.1.5",
44
"description": "Sidecar for rotating log files to objectstore",
55
"main": "index.js",
66
"scripts": {

src/broker/broker.service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ export class BrokerService {
9090
if (!unwrapToken) {
9191
return wrappedTokenResponse.wrap_info.token;
9292
}
93-
const vault = new VaultService(wrappedTokenResponse.wrap_info.token);
94-
const unwrappedToken = await vault.unwrapToken(
93+
const unwrappedToken = await VaultService.unwrapToken(
9594
wrappedTokenResponse.wrap_info.token,
9695
);
9796

src/broker/vault.service.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ export class VaultService {
99
this.token = token;
1010
}
1111

12-
async unwrapToken(token: string): Promise<any | undefined> {
13-
const url = `${VAULT_URL}sys/wrapping/unwrap`;
12+
static async unwrapToken(token: string): Promise<any | undefined> {
13+
const url = `${VAULT_URL}v1/sys/wrapping/unwrap`;
1414
const headers = {
1515
'Content-Type': 'application/json',
1616
'X-Vault-Token': token,
@@ -23,7 +23,7 @@ export class VaultService {
2323
}
2424

2525
async read(path: string): Promise<any> {
26-
const url = `${VAULT_URL}${path}`;
26+
const url = `${VAULT_URL}v1/${path}`;
2727
const headers = {
2828
'Content-Type': 'application/json',
2929
[this.HEADER_VAULT_TOKEN]: this.token,
@@ -43,7 +43,7 @@ export class VaultService {
4343
}
4444

4545
async revokeToken(): Promise<number> {
46-
const url = `${VAULT_URL}auth/token/revoke-self`;
46+
const url = `${VAULT_URL}v1/auth/token/revoke-self`;
4747
const headers = {
4848
'Content-Type': 'application/json',
4949
[this.HEADER_VAULT_TOKEN]: this.token,

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const VAULT_CRED_KEYS_BUCKET = process.env.VAULT_CRED_KEYS_BUCKET ?? '';
6363
export const VAULT_CRED_KEYS_SECRET_KEY =
6464
process.env.VAULT_CRED_KEYS_SECRET_KEY ?? '';
6565
export const VAULT_URL =
66-
process.env.VAULT_URL ?? 'https://knox.io.nrs.gov.bc.ca';
66+
process.env.VAULT_URL ?? 'https://knox.io.nrs.gov.bc.ca/';
6767

6868
export enum DB_FILE_STATUS {
6969
Moved,

0 commit comments

Comments
 (0)