Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default vault url #11

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
3 changes: 1 addition & 2 deletions src/broker/broker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

Expand Down
8 changes: 4 additions & 4 deletions src/broker/vault.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class VaultService {
this.token = token;
}

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

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

async revokeToken(): Promise<number> {
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,
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down