diff --git a/package.json b/package.json index d055e60..4aaae3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nr-objectstore-rotate", - "version": "1.1.4", + "version": "1.1.5", "description": "Sidecar for rotating log files to objectstore", "main": "index.js", "scripts": { diff --git a/src/broker/broker.service.ts b/src/broker/broker.service.ts index 50371f3..c21a99b 100644 --- a/src/broker/broker.service.ts +++ b/src/broker/broker.service.ts @@ -90,8 +90,7 @@ export class BrokerService { if (!unwrapToken) { return wrappedTokenResponse.wrap_info.token; } - const vault = new VaultService(wrappedTokenResponse.wrap_info.token); - const unwrappedToken = await vault.unwrapToken( + const unwrappedToken = await VaultService.unwrapToken( wrappedTokenResponse.wrap_info.token, ); diff --git a/src/broker/vault.service.ts b/src/broker/vault.service.ts index 834cc63..3d9092e 100644 --- a/src/broker/vault.service.ts +++ b/src/broker/vault.service.ts @@ -9,8 +9,8 @@ export class VaultService { this.token = token; } - async unwrapToken(token: string): Promise { - const url = `${VAULT_URL}sys/wrapping/unwrap`; + static async unwrapToken(token: string): Promise { + const url = `${VAULT_URL}v1/sys/wrapping/unwrap`; const headers = { 'Content-Type': 'application/json', 'X-Vault-Token': token, @@ -23,7 +23,7 @@ export class VaultService { } async read(path: string): Promise { - const url = `${VAULT_URL}${path}`; + const url = `${VAULT_URL}v1/${path}`; const headers = { 'Content-Type': 'application/json', [this.HEADER_VAULT_TOKEN]: this.token, @@ -43,7 +43,7 @@ export class VaultService { } async revokeToken(): Promise { - const url = `${VAULT_URL}auth/token/revoke-self`; + const url = `${VAULT_URL}v1/auth/token/revoke-self`; const headers = { 'Content-Type': 'application/json', [this.HEADER_VAULT_TOKEN]: this.token, diff --git a/src/constants.ts b/src/constants.ts index a6fc39c..26c2cce 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -63,7 +63,7 @@ export const VAULT_CRED_KEYS_BUCKET = process.env.VAULT_CRED_KEYS_BUCKET ?? ''; export const VAULT_CRED_KEYS_SECRET_KEY = process.env.VAULT_CRED_KEYS_SECRET_KEY ?? ''; export const VAULT_URL = - process.env.VAULT_URL ?? 'https://knox.io.nrs.gov.bc.ca'; + process.env.VAULT_URL ?? 'https://knox.io.nrs.gov.bc.ca/'; export enum DB_FILE_STATUS { Moved,