Skip to content

Commit

Permalink
Fixing makefile rego wasm compile output directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mattschoch committed Jan 18, 2024
1 parent 1c773d2 commit e1cf4dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions apps/authz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,15 @@ authz/test/e2e:
# === Open Policy Agent & Rego ===

authz/rego/compile:
rm -rf ${AUTHZ_PROJECT_DIR}/src/app/opa/build

mkdir -p ${AUTHZ_PROJECT_DIR}/src/app/opa/build

rm -rf ./rego-build
mkdir -p ./rego-build
opa build \
--target wasm \
--entrypoint main/evaluate \
--bundle ${AUTHZ_PROJECT_DIR}/src/app/opa/rego \
--ignore "__test__" \
--output ${AUTHZ_PROJECT_DIR}/src/app/opa/build/policies.tar.gz

tar -xzf ${AUTHZ_PROJECT_DIR}/src/app/opa/build/policies.tar.gz -C ${AUTHZ_PROJECT_DIR}/src/app/opa/build
--output ./rego-build/policies.gz
tar -xzf ./rego-build/policies.gz -C ./rego-build/

authz/rego/wasm:
npx ts-node \
Expand All @@ -63,6 +60,7 @@ authz/rego/bundle:
authz/rego/eval:
opa eval \
--format="pretty" \
--target="wasm" \
--bundle ${AUTHZ_PROJECT_DIR}/src/app/opa/build/policies.tar.gz \
--input ${AUTHZ_PROJECT_DIR}/src/app/opa/rego/input.json \
'data.main.evaluate'
Expand Down
2 changes: 1 addition & 1 deletion apps/authz/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AppService {

#finalizeDecision(response: OpaResult[]) {
const firstResponse = response[0]
if (firstResponse.decision === 'forbid' && !firstResponse.reasons?.every((r) => r.decision === 'forbid')) {
if (firstResponse.decision === 'forbid' && firstResponse.reasons?.every((r) => r.decision === 'forbid')) {
return {
originalResponse: firstResponse,
decision: NarvalDecision.Forbid
Expand Down

0 comments on commit e1cf4dd

Please sign in to comment.