From 5be5724e556133ce51a8b21621f2eed0dc88cc7d Mon Sep 17 00:00:00 2001 From: Matthew Bystedt Date: Tue, 4 Jul 2023 14:21:11 -0700 Subject: [PATCH] fix: release 3.0.0 doc and script issue (#86) * fix: release 3.0.0 doc and script issue * fix: move set of vault environment before validation --- README.md | 2 +- package.json | 2 +- scripts/db/mongo-setup.js | 1 + src/intention/intention.service.ts | 22 +++++++++++----------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 761e4e2a..f2bcb5f8 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ $ ./scripts/mongo-setup.sh ```bash # Start up local vault -$ podman run -p 8200:8200 --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=myroot' -d --name=broker-vault vault +$ podman run -p 8200:8200 --cap-add=IPC_LOCK -e 'VAULT_DEV_ROOT_TOKEN_ID=myroot' -d --name=broker-vault hashicorp/vault ``` Once started, you must run the vault setup script to bootstrap it. diff --git a/package.json b/package.json index 1cb3f935..151298ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nr-broker", - "version": "3.0.0", + "version": "3.0.1", "description": "", "author": "", "private": true, diff --git a/scripts/db/mongo-setup.js b/scripts/db/mongo-setup.js index d2dff3e7..c4df0a2d 100644 --- a/scripts/db/mongo-setup.js +++ b/scripts/db/mongo-setup.js @@ -38,6 +38,7 @@ db.environment.insertOne({ aliases: [], vertex: result.insertedId, }); +result = db.vertex.insertOne({ collection: 'environment', name: 'tools' }); db.environment.insertOne({ name: 'tools', short: 'tools', diff --git a/src/intention/intention.service.ts b/src/intention/intention.service.ts index 52162bb0..0c950ddb 100644 --- a/src/intention/intention.service.ts +++ b/src/intention/intention.service.ts @@ -107,6 +107,17 @@ export class IntentionService { } for (const action of intentionDto.actions) { + const envDto = envMap[action.service.environment]; + if ( + action.vaultEnvironment === undefined && + envDto && + (envDto.name === 'production' || + envDto.name === 'test' || + envDto.name === 'development' || + envDto.name === 'tools') + ) { + action.vaultEnvironment = envDto.name; + } const validationResult = this.actionService.validate( intentionDto, action, @@ -126,17 +137,6 @@ export class IntentionService { trace_id: action.trace.hash, outcome: validationResult === null ? 'success' : 'failure', }; - const envDto = envMap[action.service.environment]; - if ( - action.vaultEnvironment === undefined && - envDto && - (envDto.name === 'production' || - envDto.name === 'test' || - envDto.name === 'development' || - envDto.name === 'tools') - ) { - action.vaultEnvironment = envDto.name; - } } const isSuccessfulOpen = actionFailures.length === 0; this.auditService.recordIntentionOpen(req, intentionDto, isSuccessfulOpen);