Skip to content
Snippets Groups Projects
Commit 90ea6bf5 authored by migudel's avatar migudel :speech_balloon:
Browse files

Merge branch 'fix/kong-review' into 'develop'

Fix/kong review

See merge request !33
parents 4a55c79e eaf26664
No related branches found
No related tags found
2 merge requests!36Develop,!33Fix/kong review
Showing
with 199 additions and 114 deletions
......@@ -2,31 +2,39 @@
# Environment
#######################################
## Meter aquí cosas sobre las keys del token y esas mierdas
#######################################
# APIs
#######################################
## AUTH
API_AUTH_ENDPOINT=/users
API_AUTH_HOSTNAME=auth-api
API_AUTH_PORT=8101
API_AUTH_URL=http://$API_AUTH_HOSTNAME:$API_AUTH_PORT$API_AUTH_ENDPOINT
API_AUTH_URL=http://$API_AUTH_HOSTNAME:$API_AUTH_PORT
API_AUTH_TOKEN_URL=$API_AUTH_URL/token
## Bookings
API_BOOKINGS_ENDPOINT=/bookings
API_BOOKINGS_HOSTNAME=bookings-api
API_BOOKINGS_PORT=8401
API_BOOKINGS_URL=http://$API_BOOKINGS_HOSTNAME:$API_BOOKINGS_PORT$API_BOOKINGS_ENDPOINT
API_BOOKINGS_URL=http://$API_BOOKINGS_HOSTNAME:$API_BOOKINGS_PORT
## Hotels
API_HOTELS_ENDPOINT=/hotels
API_HOTELS_HOSTNAME=hotels-api
API_HOTELS_PORT=8301
API_HOTELS_URL=http://$API_HOTELS_HOSTNAME:$API_HOTELS_PORT$API_HOTELS_ENDPOINT
API_HOTELS_URL=http://$API_HOTELS_HOSTNAME:$API_HOTELS_PORT
## Users
API_USERS_ENDPOINT=/users
API_USERS_HOSTNAME=users-api
API_USERS_PORT=8201
API_USERS_URL=http://$API_USERS_HOSTNAME:$API_USERS_PORT$API_USERS_ENDPOINT
API_USERS_URL=http://$API_USERS_HOSTNAME:$API_USERS_PORT
## Kong
# Kong configuration
API_KONG_HOSTNAME=kong
API_KONG_PORT=8000
API_KONG_URL=http://$API_KONG_HOSTNAME:$API_KONG_PORT
API_KONG_GATEWAY=$API_KONG_URL/api
# Kong Routes
API_KONG_ROUTE_AUTH_URL=$API_KONG_GATEWAY/auth
API_KONG_ROUTE_BOOKINGS_URL=$API_KONG_GATEWAY/bookings
API_KONG_ROUTE_CLIENTS_URL=$API_KONG_GATEWAY/users/clients
API_KONG_ROUTE_HOTELS_URL=$API_KONG_GATEWAY/hotels
API_KONG_ROUTE_MANAGERS_URL=$API_KONG_GATEWAY/users/managers
API_KONG_ROUTE_USERS_URL=$API_KONG_GATEWAY/users
#
#######################################
# Databases
......@@ -40,3 +48,9 @@ DB_HOTELS_HOSTNAME=HotelsDB
## DB Users
DB_USERS_DATABASE=Users
DB_USERS_HOSTNAME=UsersDB
#
#######################################
# JWT
#######################################
JWT_KEY=MiClaveDeSeguridadMuyLargaParaQueNoFalleSpringBoot
JWT_KID=9L8RmLEKMFd54WrR06CE9zoRSAGpCWeu
### Own ###
taller
.trunk/
*.pdf
**/target/
**/.vscode
......@@ -7,4 +7,3 @@ taller
**/*.tmp
*.ln
*.log
\ No newline at end of file
File added
......@@ -8,6 +8,26 @@ networks: #Red interna para comunicar los servicios
kong-net:
services:
#######################################
# Cliente Angular
#######################################
# RoomsBooking-Web:
# image: roomsbooking-web-image
# build:
# context: ./angular/RestClient
# dockerfile: ./Dockerfile
# restart: unless-stopped
# ports:
# - 4200:80
# networks:
# - kong-net
# depends_on:
# - kong
# - Auth-API
# - Users-API
# - Hotels-API
# - Bookings-API
#######################################
# Kong
#######################################
......@@ -15,7 +35,7 @@ services:
# Postgres: The database used by Kong
kong-database:
image: postgres:9.6
container_DATABASE: kong-postgres
container_name: kong-postgres
restart: on-failure
networks:
- kong-net
......@@ -108,7 +128,26 @@ services:
kong-database:
condition: service_healthy
ports:
- 1337:133
- 1337:1337
#######################################
# Generate Data
#######################################
Generate-APIs-Data:
image: gen-apis-data
build:
context: ./poblate
dockerfile: Dockerfile
networks:
- kong-net
restart: on-failure
depends_on:
- kong
- Auth-API
- Users-API
- Hotels-API
- Bookings-API
#######################################
# APIs
......@@ -124,10 +163,11 @@ services:
networks:
- kong-net
environment:
# TODO Meter kid y secret key
KID: ${JWT_KID}
SECRET_KEY: ${JWT_KID}
EXTERNAL_SERVICE_USERS_URL: ${API_USERS_URL}${API_USERS_ENDPOINT}
SECURITY_JWT_SECRET-KEY: ${JWT_KEY}
SECURITY_JWT_KID: ${JWT_KID}
SECURITY_JWT_EXTERNAL_EXPIRATION: ${JWT_EXTERNAL_EXPIRATION:-3600}
SECURITY_JWT_INTERNAL_EXPIRATION: ${JWT_INTERNAL_EXPIRATION:-600}
SERVICES_EXTERNAL_USERS_URL: ${API_KONG_ROUTE_USERS_URL}
depends_on:
- Users-API
......@@ -135,14 +175,16 @@ services:
image: users-api-image
hostname: ${API_USERS_HOSTNAME}
build:
context: ./java/services/user
context: ./java/services/users
dockerfile: Dockerfile
restart: unless-stopped
networks:
- kong-net
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://${DB_USERS_HOSTNAME}:${DB_USERS_PORT:-3306}/${DB_USERS_DATABASE}?createDatabaseIfNotExist=true
EXTERNAL_SERVICE_USERS_URL: ${API_USERS_URL}${API_USERS_ENDPOINT}
SERVICES_INTERNAL_TOKEN_URL: ${API_AUTH_TOKEN_URL}
SERVICES_EXTERNAL_HOTELS_URL: ${API_KONG_ROUTE_HOTELS_URL}
SERVICES_EXTERNAL_BOOKINGS_URL: ${API_KONG_ROUTE_BOOKINGS_URL}
depends_on:
- Users-DB
......@@ -157,6 +199,9 @@ services:
- kong-net
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://${DB_HOTELS_HOSTNAME}:${DB_HOTELS_PORT:-3306}/${DB_HOTELS_DATABASE}?createDatabaseIfNotExist=true
SERVICES_INTERNAL_TOKEN_URL: ${API_AUTH_TOKEN_URL}
SERVICES_EXTERNAL_MANAGERS_URL: ${API_KONG_ROUTE_MANAGERS_URL}
SERVICES_EXTERNAL_BOOKINGS_URL: ${API_KONG_ROUTE_BOOKINGS_URL}
depends_on:
- Hotels-DB
......@@ -171,6 +216,11 @@ services:
- kong-net
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://${DB_BOOKINGS_HOSTNAME}:${DB_BOOKINGS_PORT:-3306}/${DB_BOOKINGS_DATABASE}?createDatabaseIfNotExist=true
SERVICES_INTERNAL_TOKEN_URL: ${API_AUTH_TOKEN_URL}
SERVICES_EXTERNAL_CLIENTS_URL: ${API_KONG_ROUTE_CLIENTS_URL}
SERVICES_EXTERNAL_MANAGERS_URL: ${API_KONG_ROUTE_MANAGERS_URL}
SERVICES_EXTERNAL_HOTELS_URL: ${API_KONG_ROUTE_HOTELS_URL}
depends_on:
- Users-API
- Hotels-API
......@@ -223,26 +273,10 @@ services:
networks:
- kong-net
volumes:
- hotels_data:/var/lib/mysql
- bookings_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ${DB_CREDENTIALS_ROOT_PASSWORD:-ClaveRoot}
MYSQL_USER: ${DB_CREDENTIALS_USER:-user}
MYSQL_PASSWORD: ${DB_CREDENTIALS_PASSWORD:-password}
MYSQL_DATABASE: ${DB_BOOKINGS_DATABASE}
MYSQL_ROOT_HOST: "%"
#######################################
# Cliente Angular
#######################################
RoomsBooking-Web:
image: roomsbooking-web-image
build:
context: ./angular/RestClient
dockerfile: ./Dockerfile
restart: unless-stopped
ports:
- 4200:80
networks:
- kong-net
depends_on:
- RoomsBooking-database
......@@ -55,14 +55,14 @@ public class UserAPI {
*/
public User registerUser(RegisterRequest registerRequest) {
String url = USER_API_URL;
System.out.println(url + " " + registerRequest);
try {
ResponseEntity<User> userResponse = restTemplate.postForEntity(url, registerRequest, User.class);
if (!userResponse.getStatusCode().is2xxSuccessful()) {
String errorMessage = "Failed to register user: " + userResponse.getStatusCode() + ". " + userResponse.getBody();
throw new HttpClientErrorException(userResponse.getStatusCode(), errorMessage);
}
return userResponse.getBody();
} catch (HttpClientErrorException ex) {
if (ex.getStatusCode() == HttpStatus.BAD_REQUEST)
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Register failed");
throw ex;
}
}
/**
......
......@@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
import com.uva.api.auth.models.auth.LoginRequest;
import com.uva.api.auth.models.auth.RegisterRequest;
......@@ -25,26 +24,12 @@ public class AuthController {
@PostMapping("/login")
public ResponseEntity<?> login(@RequestBody LoginRequest loginRequest) {
try {
return authService.login(loginRequest);
} catch (HttpClientErrorException e) {
if (e.getStatusCode() == HttpStatus.FORBIDDEN) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.FORBIDDEN);
}
}
return new ResponseEntity<>("Algo no fue bien", HttpStatus.UNAUTHORIZED);
}
@PostMapping("/register")
public ResponseEntity<?> register(@RequestBody RegisterRequest registerRequest) {
try {
return authService.register(registerRequest);
} catch (HttpClientErrorException e) {
if (e.getStatusCode() == HttpStatus.CONFLICT)
return new ResponseEntity<>(e.getMessage(), HttpStatus.CONFLICT);
}
return new ResponseEntity<>("Algo no fue bien", HttpStatus.UNAUTHORIZED);
}
@PostMapping("/password")
......
package com.uva.api.auth.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.client.HttpClientErrorException;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(HttpClientErrorException.class)
public ResponseEntity<Map<String, Object>> handleHttpClientErrorException(HttpClientErrorException ex) {
Map<String, Object> body = new HashMap<>();
body.put("timestamp", LocalDateTime.now());
body.put("message", ex.getMessage());
return new ResponseEntity<>(body, ex.getStatusCode());
}
@ExceptionHandler(Exception.class)
public ResponseEntity<Map<String, Object>> handleGeneralException(Exception ex) {
Map<String, Object> body = new HashMap<>();
body.put("timestamp", LocalDateTime.now());
body.put("message", "An unexpected error occurred: " + ex.getMessage());
return new ResponseEntity<>(body, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
......@@ -79,7 +79,7 @@ public class AuthService {
public ResponseEntity<?> changePassword(String token, String actualPass, String newPass) {
JwtData decoded = jwtUtil.decodeToken(token);
if (decoded == null)
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
throw new HttpClientErrorException(HttpStatus.FORBIDDEN);
String email = decoded.getEmail();
User user = getUser(email, actualPass);
......@@ -87,23 +87,22 @@ public class AuthService {
boolean changePasswordAllowed = decoded.isAdmin() || user != null;
if (user != null && !validStrings(actualPass, newPass))
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST);
if (!changePasswordAllowed)
throw new HttpClientErrorException(HttpStatus.FORBIDDEN, "Invalid credentials");
if (changePasswordAllowed) {
// Actualizamos la nueva
String hashPass = SecurityUtils.encrypt(newPass);
userAPI.changePassword(user, hashPass);
// Hacemos un login con los nuevos datos
return login(new LoginRequest(email, newPass));
} else {
return new ResponseEntity<>("Invalid credentials", HttpStatus.FORBIDDEN);
}
}
public ResponseEntity<?> deleteUser(String token, int id, String password) {
JwtData decoded = jwtUtil.decodeToken(token);
if (decoded == null)
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
throw new HttpClientErrorException(HttpStatus.FORBIDDEN);
String email = decoded.getEmail();
User user = getUser(email, password);
......@@ -112,13 +111,12 @@ public class AuthService {
|| (user != null && user.getId() == id);
if (user != null && !validStrings(password))
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST);
if (!changePasswordAllowed)
throw new HttpClientErrorException(HttpStatus.FORBIDDEN, "Invalid credentials");
if (changePasswordAllowed) {
userAPI.deleteUser(user);
return new ResponseEntity<>(HttpStatus.OK);
} else {
return new ResponseEntity<>("Invalid credentials", HttpStatus.FORBIDDEN);
}
return ResponseEntity.ok(user);
}
}
......@@ -2,9 +2,9 @@ spring.application.name=authentication
server.port=8101
security.jwt.secret-key=MiClaveDeSeguridadMuyLargaParaQueNoFalleSpringBoot
# 1h in seconds
# Tiempo de validez para tokens para usuarios (externos) 1h in seconds
security.jwt.external.expiration=3600
# 10min in seconds
# Tiempo de validez para tokens para servicios (internos) 10min in seconds
security.jwt.internal.expiration=600
security.jwt.kid=cYz3kNRLAirxVhHXQ5rh5xKrOwHwZVui
......
......@@ -14,12 +14,15 @@ public class UserApi {
@Autowired
private RestTemplate restTemplate;
@Value("${services.external.users.url}")
private String USERS_API_URL;
@Value("${services.external.clients.url}")
private String CLIENTS_API_URL;
@Value("${services.external.managers.url}")
private String MANAGERS_API_URL;
public boolean existsClientById(int id) {
try {
String url = USERS_API_URL + "/clients/{id}";
String url = CLIENTS_API_URL + "/{id}";
ResponseEntity<Void> response = restTemplate.getForEntity(url, Void.class, id);
return response.getStatusCode() == HttpStatus.OK;
} catch (HttpClientErrorException ex) {
......@@ -32,7 +35,7 @@ public class UserApi {
public boolean existsManagerById(int id) {
try {
String url = USERS_API_URL + "/managers/{id}";
String url = MANAGERS_API_URL + "/{id}";
ResponseEntity<Void> response = restTemplate.getForEntity(url, Void.class, id);
return response.getStatusCode() == HttpStatus.OK;
} catch (HttpClientErrorException ex) {
......
......@@ -7,8 +7,10 @@ spring.datasource.username=user
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.security.user.enabled=false
spring.security.user.name=user
spring.security.user.password=password
services.internal.token.url=http://localhost:8101/token
services.external.users.url=http://localhost:8201/users
services.external.clients.url=http://localhost:8201/users/clients
services.external.managers.url=http://localhost:8201/users/managers
services.external.hotels.url=http://localhost:8301/hotels
\ No newline at end of file
......@@ -7,12 +7,8 @@ spring.datasource.username=user
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.security.user.enabled=false
security.jwt.secret-key=MiClaveDeSeguridadMuyLargaParaQueNoFalleSpringBoot
# 1h in millisecond
security.jwt.expiration-time=3600000
security.jwt.kid=cYz3kNRLAirxVhHXQ5rh5xKrOwHwZVui
spring.security.user.name=user
spring.security.user.password=password
services.internal.token.url=http://localhost:8101/token
services.external.managers.url=http://localhost:8201/users/managers
......
......@@ -4,6 +4,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.client.HttpClientErrorException;
import java.time.LocalDateTime;
import java.util.HashMap;
......@@ -21,6 +22,15 @@ public class GlobalExceptionHandler {
return new ResponseEntity<>(body, HttpStatus.NOT_FOUND);
}
@ExceptionHandler(HttpClientErrorException.class)
public ResponseEntity<Map<String, Object>> handleHttpClientErrorException(HttpClientErrorException ex) {
Map<String, Object> body = new HashMap<>();
body.put("timestamp", LocalDateTime.now());
body.put("message", ex.getMessage());
return new ResponseEntity<>(body, ex.getStatusCode());
}
@ExceptionHandler(Exception.class)
public ResponseEntity<Map<String, Object>> handleGeneralException(Exception ex) {
Map<String, Object> body = new HashMap<>();
......
......@@ -8,4 +8,6 @@ import com.uva.api.users.models.User;
public interface UserRepository extends JpaRepository<User, Integer> {
Optional<User> findByEmail(String email);
Boolean existsByEmail(String email);
}
......@@ -3,7 +3,6 @@ package com.uva.api.users.services;
import java.time.LocalDate;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
......@@ -42,9 +41,7 @@ public class ClientService {
return client;
}
public Client save(User request) {
Client client = new Client();
BeanUtils.copyProperties(request, client);
public Client save(Client client) {
// Default rol
client.setRol(UserRol.CLIENT);
return clientRepository.save(client);
......
......@@ -2,13 +2,10 @@ package com.uva.api.users.services;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.uva.api.users.api.HotelApi;
import com.uva.api.users.models.Manager;
import com.uva.api.users.models.User;
import com.uva.api.users.repositories.ManagerRepository;
import com.uva.api.users.utils.Utils;
......@@ -21,10 +18,8 @@ public class ManagerService {
@Autowired
private ManagerRepository managerRepository;
public Manager save(User request) {
Manager hm = new Manager();
BeanUtils.copyProperties(request, hm);
return managerRepository.save(hm);
public Manager save(Manager manager) {
return managerRepository.save(manager);
}
public List<Manager> findAll() {
......
......@@ -4,10 +4,14 @@ import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpClientErrorException;
import com.uva.api.users.models.AuthDTO;
import com.uva.api.users.models.Client;
import com.uva.api.users.models.Manager;
import com.uva.api.users.models.User;
import com.uva.api.users.models.UserRol;
import com.uva.api.users.repositories.UserRepository;
......@@ -47,6 +51,9 @@ public class UserService {
}
public ResponseEntity<User> registerNewUser(AuthDTO request) {
if (userRepository.existsByEmail(request.getEmail()))
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST);
User user = new User();
BeanUtils.copyProperties(request, user);
......@@ -62,12 +69,16 @@ public class UserService {
break;
case HOTEL_ADMIN:
user = managerService.save(user);
Manager manager = new Manager();
BeanUtils.copyProperties(request, manager);
user = managerService.save(manager);
break;
case CLIENT: // By default
default:
user = clientService.save(user);
Client client = new Client();
BeanUtils.copyProperties(request, client);
user = clientService.save(client);
break;
}
return ResponseEntity.ok(user);
......
......@@ -10,11 +10,6 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.security.user.name=user
spring.security.user.password=password
security.jwt.secret-key=MiClaveDeSeguridadMuyLargaParaQueNoFalleSpringBoot
# 1h in millisecond
security.jwt.expiration-time=3600000
security.jwt.kid=cYz3kNRLAirxVhHXQ5rh5xKrOwHwZVui
services.internal.token.url=http://localhost:8101/token/
services.external.hotels.url=http://localhost:8301/hotels
services.external.bookings.url=http://localhost:8401/bookings
\ No newline at end of file
{"createdUser":null,"updatedUser":null,"id":1,"name":"Practica","kong_node_name":"Kong","kong_node_url":"http://kong:8001","kong_version":"3.9.0","data":{"services":[{"retries":5,"tags":[],"created_at":1735150914,"updated_at":1735150914,"name":"Users","port":8201,"id":"1d1ce8d9-aa4b-4576-8d91-00326d00c26e","client_certificate":null,"write_timeout":60000,"connect_timeout":60000,"read_timeout":60000,"protocol":"http","enabled":true,"ca_certificates":null,"tls_verify":null,"path":"/users","tls_verify_depth":null,"host":"users-api","extras":{"id":1,"service_id":"1d1ce8d9-aa4b-4576-8d91-00326d00c26e","kong_node_id":"1","description":null,"tags":null,"createdAt":"2024-12-25T18:21:54.000Z","updatedAt":"2024-12-25T18:21:54.000Z","createdUser":null,"updatedUser":null}},{"retries":5,"tags":[],"created_at":1735151821,"updated_at":1735151821,"name":"Hotels","port":8301,"id":"37407f92-1d9f-4d88-b80f-0bc9a3fb57fd","client_certificate":null,"write_timeout":60000,"connect_timeout":60000,"read_timeout":60000,"protocol":"http","enabled":true,"ca_certificates":null,"tls_verify":null,"path":"/hotels","tls_verify_depth":null,"host":"hotels-api","extras":{"id":3,"service_id":"37407f92-1d9f-4d88-b80f-0bc9a3fb57fd","kong_node_id":"1","description":null,"tags":null,"createdAt":"2024-12-25T18:37:01.000Z","updatedAt":"2024-12-25T18:37:01.000Z","createdUser":null,"updatedUser":null}},{"retries":5,"tags":[],"created_at":1735151037,"updated_at":1735151134,"name":"Auth","port":8101,"id":"60e76e38-63f1-4fd7-b10c-51456722a312","client_certificate":null,"write_timeout":60000,"connect_timeout":60000,"read_timeout":60000,"protocol":"http","enabled":true,"ca_certificates":null,"tls_verify":null,"path":"/auth","tls_verify_depth":null,"host":"auth-api","extras":{"id":2,"service_id":"60e76e38-63f1-4fd7-b10c-51456722a312","kong_node_id":"1","description":null,"tags":null,"createdAt":"2024-12-25T18:23:57.000Z","updatedAt":"2024-12-25T18:25:34.000Z","createdUser":null,"updatedUser":null}},{"retries":5,"tags":[],"created_at":1735151922,"updated_at":1735151922,"name":"Bookings","port":8401,"id":"ae250c19-10c3-4ed2-8cdb-d62497721da2","client_certificate":null,"write_timeout":60000,"connect_timeout":60000,"read_timeout":60000,"protocol":"http","enabled":true,"ca_certificates":null,"tls_verify":null,"path":"/bookings","tls_verify_depth":null,"host":"bookings-api","extras":{"id":4,"service_id":"ae250c19-10c3-4ed2-8cdb-d62497721da2","kong_node_id":"1","description":null,"tags":null,"createdAt":"2024-12-25T18:38:42.000Z","updatedAt":"2024-12-25T18:38:42.000Z","createdUser":null,"updatedUser":null}}],"routes":[{"tags":null,"created_at":1735151865,"updated_at":1735151865,"name":"hotels","destinations":null,"strip_path":true,"hosts":null,"methods":["GET","POST","PUT","PATCH","DELETE","OPTIONS"],"service":{"id":"37407f92-1d9f-4d88-b80f-0bc9a3fb57fd"},"preserve_host":false,"regex_priority":0,"headers":null,"paths":["/api/hotels"],"request_buffering":true,"response_buffering":true,"protocols":["http","https"],"sources":null,"id":"17bc07be-9af8-499f-9ec6-716504cd801f","path_handling":"v1","https_redirect_status_code":426,"snis":null},{"tags":null,"created_at":1735151081,"updated_at":1735151965,"name":"Auth","destinations":null,"strip_path":true,"hosts":null,"methods":["OPTIONS","POST","DELETE"],"service":{"id":"60e76e38-63f1-4fd7-b10c-51456722a312"},"preserve_host":false,"regex_priority":0,"headers":null,"paths":["/api/auth"],"request_buffering":true,"response_buffering":true,"protocols":["http","https"],"sources":null,"id":"4f7e698c-aed6-4919-8d72-a24ce6a2a333","path_handling":"v1","https_redirect_status_code":426,"snis":null},{"tags":null,"created_at":1735151945,"updated_at":1735151945,"name":"Bookings","destinations":null,"strip_path":true,"hosts":null,"methods":["GET","POST","PATCH","PUT","DELETE","OPTIONS"],"service":{"id":"ae250c19-10c3-4ed2-8cdb-d62497721da2"},"preserve_host":false,"regex_priority":0,"headers":null,"paths":["/api/bookings"],"request_buffering":true,"response_buffering":true,"protocols":["http","https"],"sources":null,"id":"810bbb6d-a10d-416d-b5db-a121762981fa","path_handling":"v1","https_redirect_status_code":426,"snis":null},{"tags":null,"created_at":1735150976,"updated_at":1735150976,"name":"Usuarios","destinations":null,"strip_path":true,"hosts":null,"methods":["OPTIONS","GET","POST","DELETE","PUT","PATCH"],"service":{"id":"1d1ce8d9-aa4b-4576-8d91-00326d00c26e"},"preserve_host":false,"regex_priority":0,"headers":null,"paths":["/api/users"],"request_buffering":true,"response_buffering":true,"protocols":["http","https"],"sources":null,"id":"df0fefa6-7df8-4ae3-baed-ae58add42bbf","path_handling":"v1","https_redirect_status_code":426,"snis":null}],"consumers":[{"id":"c012b84f-63af-461f-8a8d-b8f99a2bd006","tags":[],"created_at":1735155577,"updated_at":1735155577,"custom_id":null,"username":"JWT","credentials":{"jwts":[{"rsa_public_key":null,"algorithm":"HS256","tags":null,"created_at":1735155689,"key":"9L8RmLEKMFd54WrR06CE9zoRSAGpCWeu","consumer":{"id":"c012b84f-63af-461f-8a8d-b8f99a2bd006"},"id":"493ad0f9-23e7-4e5f-b6e1-6982677ba0d6","secret":"MiClaveDeSeguridadMuyLargaParaQueNoFalleSpringBoot"}]}}],"plugins":[{"config":{"secret_is_base64":false,"key_claim_name":"kid","claims_to_verify":["exp"],"maximum_expiration":0,"uri_param_names":["jwt"],"cookie_names":[],"header_names":["Authorization"],"realm":null,"run_on_preflight":true,"anonymous":null},"tags":null,"created_at":1735155843,"updated_at":1735155843,"name":"jwt","route":{"id":"810bbb6d-a10d-416d-b5db-a121762981fa"},"consumer":null,"id":"3e302549-c51f-469d-a71d-98f30f2ddcab","protocols":["grpc","grpcs","http","https"],"instance_name":null,"service":null,"enabled":true},{"config":{"secret_is_base64":false,"key_claim_name":"kid","claims_to_verify":["exp"],"maximum_expiration":0,"uri_param_names":["jwt"],"cookie_names":[],"header_names":["Authorization"],"realm":null,"run_on_preflight":true,"anonymous":null},"tags":null,"created_at":1735156525,"updated_at":1735156585,"name":"jwt","route":{"id":"df0fefa6-7df8-4ae3-baed-ae58add42bbf"},"consumer":null,"id":"8386bf54-ede1-4f34-bb87-989ce4276e8a","protocols":["grpc","grpcs","http","https"],"instance_name":null,"service":null,"enabled":true},{"config":{"secret_is_base64":false,"key_claim_name":"kid","claims_to_verify":["exp"],"maximum_expiration":0,"uri_param_names":["jwt"],"cookie_names":[],"header_names":["Authorization"],"realm":null,"run_on_preflight":true,"anonymous":null},"tags":null,"created_at":1735156492,"updated_at":1735156600,"name":"jwt","route":{"id":"17bc07be-9af8-499f-9ec6-716504cd801f"},"consumer":null,"id":"9ac23748-1964-4038-8cdc-b2db799010a6","protocols":["grpc","grpcs","http","https"],"instance_name":null,"service":null,"enabled":true}],"acls":[],"upstreams":[],"certificates":[],"snis":[]},"createdAt":"2024-12-25T19:59:28.000Z","updatedAt":"2024-12-25T19:59:28.000Z"}
\ No newline at end of file
FROM node:20
# Establecer el directorio de trabajo
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "run", "prod", "--", "-d"]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment