Skip to content

Commit 0c20363

Browse files
Change configurations
1 parent fbad7d1 commit 0c20363

File tree

5 files changed

+41
-15
lines changed

5 files changed

+41
-15
lines changed

.vscode/launch.json

+16-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,23 @@
44
{
55
"type": "node",
66
"request": "attach",
7-
"name": "DB MARVEL_API",
7+
"name": "Debug MARVEL_API",
88
"remoteRoot": "/usr/src/app/",
9-
"localRoot": "${workspaceFolder}/marvel/",
9+
"localRoot": "${workspaceFolder}/src/packages/marvel/",
10+
"protocol": "inspector",
11+
"port": 9230,
12+
"restart": true,
13+
"address": "localhost",
14+
"sourceMaps": true,
15+
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
16+
"skipFiles": ["<node_internals>/**"]
17+
},
18+
{
19+
"type": "node",
20+
"request": "attach",
21+
"name": "Debug AUTH_API",
22+
"remoteRoot": "/usr/src/app/",
23+
"localRoot": "${workspaceFolder}/scr/packages/auth/",
1024
"protocol": "inspector",
1125
"port": 9230,
1226
"restart": true,

Dockerfile.AuthAPI

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WORKDIR /usr/src/app
44

55
ENV NODE_ENV=local
66

7-
COPY /src/packages/auth/package*.json ./
7+
COPY ./src/packages/auth/package*.json ./
88

99
RUN npm install
1010

docker-compose.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
cockpit:
55
container_name: cockpit
66
build:
7-
context: ./src/packages/cockpit
7+
context: ./
88
volumes:
99
- ./src/packages/cockpit:/etc/nginx/
1010
ports:
@@ -17,7 +17,7 @@ services:
1717
context: ./
1818
dockerfile: ./Dockerfile.AuthAPI
1919
volumes:
20-
- ./auth/:/usr/src/app/
20+
- ./src/packages/auth/:/usr/src/app/
2121
networks:
2222
- monorepo_network
2323
ports:
@@ -30,7 +30,7 @@ services:
3030
context: ./
3131
dockerfile: ./Dockerfile.Marvel
3232
volumes:
33-
- ./marvel/:/usr/src/app/
33+
- ./src/packages/marvel/:/usr/src/app/
3434
networks:
3535
- monorepo_network
3636
ports:

src/packages/cockpit/nginx.conf

+18-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ http {
1313
'' close;
1414
}
1515

16-
map $host $dev_base_host {
16+
map $host $hml_base_url {
1717
default devenvironment.example.url.com;
1818
}
1919

@@ -37,13 +37,24 @@ http {
3737
proxy_pass_request_headers on;
3838

3939

40-
location /api/auth/ {
41-
proxy_pass http://auth_api:3000$uri$is_args$args;
42-
error_page 502 = @fallback_api_auth;
40+
location ~ ^/api/auth(/?.*)$ {
41+
proxy_pass http://auth_api:3000/auth$1?args;
42+
error_page 502 = @fallback_auth_api;
4343
}
44-
location @fallback_api_auth {
45-
proxy_set_header Host $dev_base_host;
46-
proxy_pass https://$dev_base_host/api/auth$uri$is_args$args;
44+
45+
location @fallback_auth_api {
46+
proxy_set_header Host $hml_base_url;
47+
proxy_pass https://$hml_base_url/api/auth$1?args;
48+
}
49+
50+
location ~ ^/api/marvel(/?.*)$ {
51+
proxy_pass http://marvel_api:3001/marvel$1?args;
52+
error_page 502 = @fallback_marvel_api;
53+
}
54+
55+
location @fallback_marvel_api {
56+
proxy_set_header Host $hml_base_url;
57+
proxy_pass https://$hml_base_url/api/marvel$1?args;
4758
}
4859

4960
}

src/packages/marvel/src/auth.guard.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Injectable, CanActivate, ExecutionContext, HttpStatus, Logger, HttpException } from '@nestjs/common';
22
import { lastValueFrom } from 'rxjs';
33
import { HttpService } from '@nestjs/axios'
4-
4+
import * as dotenv from 'dotenv';
5+
dotenv.config();
56

67
@Injectable()
78
export class AuthGuard implements CanActivate {
@@ -25,7 +26,7 @@ export class AuthGuard implements CanActivate {
2526
private async validateToken(token: string): Promise<boolean> {
2627

2728
try {
28-
const endpoint = `${process.env.TOKEN_VERIFY_SVC}/${token}`
29+
const endpoint = `${process.env.TOKEN_VERIFY_SVC}/verify/${token}`
2930
const getTokenValidationRequest = this.httpService.get(endpoint)
3031

3132
const result = await lastValueFrom(getTokenValidationRequest);

0 commit comments

Comments
 (0)