From 42726b805b496d355a0e31f358dc034ef9ba767d Mon Sep 17 00:00:00 2001 From: Victor Radael Date: Thu, 7 Apr 2022 16:43:59 -0300 Subject: [PATCH 1/4] FIX: Ci --- .github/workflows/deploy.yml | 8 +++++--- .github/workflows/test.yml | 10 +++++++++- src/middlewares/authentication.ts | 3 ++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e2496e9..bd40cc2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -78,9 +78,11 @@ jobs: shell: bash run: | if [ ${GITHUB_REF} == "refs/heads/main" ]; then - echo "##[set-output name=result;]$(echo "production")" - else - echo "##[set-output name=result;]$(echo ${GITHUB_REF#refs/heads/})" + echo "##[set-output name=result;]$(echo "prd")" + elif [ ${GITHUB_REF} == "refs/heads/alpha" ]; then + echo "##[set-output name=result;]$(echo "alpha")" + elif [ ${GITHUB_REF} == "refs/heads/beta" ]; then + echo "##[set-output name=result;]$(echo "stg")" fi id: extract_environment diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ec0dd7..577e189 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,6 +16,7 @@ jobs: - name: Install Docker Compose run: | python3 -m pip install docker-compose --upgrade + - name: Build env: ENV: test @@ -25,6 +26,7 @@ jobs: export ENV=test export IMAGE_TAG=test docker-compose -f build.docker-compose.yml build --build-arg NPM_TOKEN=${NPM_TOKEN} + - name: Run Test env: ENV: test @@ -33,4 +35,10 @@ jobs: run: | export ENV=test export IMAGE_TAG=test - docker-compose -f build.docker-compose.yml run -e NPM_TOKEN=${NPM_TOKEN} --rm --entrypoint="npm run test" maestro \ No newline at end of file + docker-compose -f build.docker-compose.yml run -e NPM_TOKEN=${NPM_TOKEN} --rm --entrypoint="npm run test" maestro + + - name: Remove Docker's Trash + continue-on-error: true + run: | + docker system prune + docker rmi -f $(docker images -aq) diff --git a/src/middlewares/authentication.ts b/src/middlewares/authentication.ts index 83abf9d..8fb0ccb 100644 --- a/src/middlewares/authentication.ts +++ b/src/middlewares/authentication.ts @@ -14,6 +14,7 @@ import { HttpExceptionFilter } from 'src/error/http-exception.filter'; @UseFilters(new HttpExceptionFilter()) export class LoggerMiddleware implements NestMiddleware { use = async (request: Request, response: Response, next: NextFunction) => { + console.log('Middle', new Date()); const idToken = request.get('Dadosfera-User'); const accessToken = request.get('Authorization'); const privateKey = process.env.JWT_PRIVATE_KEY; @@ -27,7 +28,7 @@ export class LoggerMiddleware implements NestMiddleware { } }); const jwtDecoded: any = decode(idToken); - console.log(jwtDecoded); + const permissions = jwtDecoded.user.permissions; const clienId = jwtDecoded.user.customerId; const userId = jwtDecoded.user.id; From 5f6ae5d51286c438c7d29751e6df4762f0b221f6 Mon Sep 17 00:00:00 2001 From: Victor Radael Date: Thu, 7 Apr 2022 17:54:14 -0300 Subject: [PATCH 2/4] FIX: CI --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bd40cc2..e1672b7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,7 +80,7 @@ jobs: if [ ${GITHUB_REF} == "refs/heads/main" ]; then echo "##[set-output name=result;]$(echo "prd")" elif [ ${GITHUB_REF} == "refs/heads/alpha" ]; then - echo "##[set-output name=result;]$(echo "alpha")" + echo "##[set-output name=result;]$(echo "dev")" elif [ ${GITHUB_REF} == "refs/heads/beta" ]; then echo "##[set-output name=result;]$(echo "stg")" fi From 708bf2f585a72f1e1e4ba050a5bd9ac60c42989c Mon Sep 17 00:00:00 2001 From: Victor Radael Date: Thu, 7 Apr 2022 18:41:39 -0300 Subject: [PATCH 3/4] FIX: Deploy --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index b226330..0ad4cb9 100644 --- a/README.md +++ b/README.md @@ -2,5 +2,3 @@

Maestro

- -x From 7d5dee4b0c00c22f22409e49c610e9a5b6f426e6 Mon Sep 17 00:00:00 2001 From: Victor Radael Date: Fri, 8 Apr 2022 12:48:40 -0300 Subject: [PATCH 4/4] FIX: Deploy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ad4cb9..c336ec3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@

Maestro

-

+

\ No newline at end of file