From 6d4dc5db7119b4d2eeea2855ad65a73df5640906 Mon Sep 17 00:00:00 2001
From: Marco Lisandro Franco <104217387+Marc0Franc0@users.noreply.github.com>
Date: Fri, 16 Feb 2024 14:39:06 -0300
Subject: [PATCH] update
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
-Cambio en la versión de Spring Boot
-Creación de perfiles para producción y desarrollo
---
README.md | 18 ++++++------------
pom.xml | 5 +++--
src/main/resources/application-dev.properties | 13 +++++++++++++
src/main/resources/application-prod.properties | 14 ++++++++++++++
src/main/resources/application.properties | 17 ++++-------------
5 files changed, 40 insertions(+), 27 deletions(-)
create mode 100644 src/main/resources/application-dev.properties
create mode 100644 src/main/resources/application-prod.properties
diff --git a/README.md b/README.md
index 66b8c09..21c1cec 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Proyecto de muestra sobre cómo implementar la seguridad con autenticación JWT
- Autorización basada en roles con Spring Security
## TecnologÃas
-- Spring Boot 3.0
+- Spring Boot 3.1.4
- Spring Security
- JSON Web Tokens (JWT)
- BCrypt
@@ -26,16 +26,11 @@ Para construir y ejecutar la aplicación necesita:
- [JDK 17+](https://www.oracle.com/java/technologies/downloads/#java17)
- [Maven 3+](https://maven.apache.org)
-Configurar datos de la base de datos MySQL: [application.properties](https://github.com/Marc0Franc0/School-Management/blob/main/src/main/resources/application.properties)
+Configurar perfil (producción o desarrollo):[application.properties](https://github.com/Marc0Franc0/User-Api-Jwt/blob/main/src/main/resources/application.properties)
-Configurar JWT: [application.properties](https://github.com/Marc0Franc0/School-Management/blob/main/src/main/resources/application.properties)
-- jwt.secret.key = esYG4cI3/jsQ1f3b+25mesq9nXsN7kIU45hPr27FyRxMd7WteShs/5VnXv1YfgMR
- (Se utiliza para firmar los tokens)
-- jwt.time.expiration = 86400000 (equivalente a un dÃa)
+Configurar variables de entorno para producción: [application-prod.properties](https://github.com/Marc0Franc0/User-Api-Jwt/blob/main/src/main/resources/application-prod.properties)
-Configurar usuario admin:
-- user.admin.username = nombre_de_usuario_admin
-- user.admin.password = contraseña_de_usuario_admin
+Configurar variables de entorno para desarrollo: [application-dev.properties](https://github.com/Marc0Franc0/User-Api-Jwt/blob/main/src/main/resources/application-dev.properties)
Ejecutar localmente
@@ -46,6 +41,5 @@ mvn clean install
mvn spring-boot:run
```
-Dirigirse a:
-- [http://localhost:8080/](http://localhost:8080/)
-- [http://localhost:8080/swagger-ui/index.html](http://localhost:8080/swagger-ui/index.html)
\ No newline at end of file
+Dirigirse a:
+- [Documentación Swagger](http://localhost:8080/swagger-ui/index.html)
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index b641f0d..ca30814 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.2
+ 3.1.4
com.app
@@ -55,7 +55,8 @@
org.projectlombok
lombok
- true
+ 1.18.30
+ provided
org.springframework.boot
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
new file mode 100644
index 0000000..b911c8e
--- /dev/null
+++ b/src/main/resources/application-dev.properties
@@ -0,0 +1,13 @@
+#Configuración base de datos
+spring.datasource.url= jdbc:mysql://localhost:3306/users
+spring.datasource.username= root
+spring.datasource.password=
+spring.datasource.jpa.hibernate.ddl-auto= update
+
+#Configuración usuario administrador
+user.admin.username= marco
+user.admin.password= 1234
+
+#Configuración JWT
+jwt.secret.key= esYG4cI3/jsQ1f3b+25mesq9nXsN7kIU45hPr27FyRxMd7WteShs/5VnXv1YfgMR
+jwt.secret.time.expiration= 86400000
\ No newline at end of file
diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties
new file mode 100644
index 0000000..8bdef9d
--- /dev/null
+++ b/src/main/resources/application-prod.properties
@@ -0,0 +1,14 @@
+
+#Configuración base de datos
+spring.datasource.url= ${SPRING_DATASOURCE_URL}
+spring.datasource.username= ${SPRING_DATASOURCE_USERNAME}
+spring.datasource.password= ${SPRING_DATASOURCE_PASSWORD}
+spring.datasource.jpa.hibernate.ddl-auto= ${SPRING_JPA_HIBERNATE_DDL_AUTO}
+
+#Configuración usuario administrador
+user.admin.username= ${USER_ADMIN_USERNAME}
+user.admin.password= ${USER_ADMIN_PASSWORD}
+
+#Configuración JWT
+jwt.secret.key= ${JWT_SECRET_KEY}
+jwt.secret.time.expiration= ${JWT_TIME_EXPIRATION}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index ba22711..260cb6d 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,13 +1,4 @@
-#Configuración base de datos
-spring.datasource.url: ${SPRING_DATASOURCE_URL}
-spring.datasource.username: ${SPRING_DATASOURCE_USERNAME}
-spring.datasource.password: ${SPRING_DATASOURCE_PASSWORD}
-spring.datasource.jpa.hibernate.ddl-auto: ${SPRING_JPA_HIBERNATE_DDL_AUTO}
-
-#Configuración usuario administrador
-user.admin.username: ${USER_ADMIN_USERNAME}
-user.admin.password: ${USER_ADMIN_PASSWORD}
-
-#Configuración JWT
-jwt.secret.key: ${JWT_SECRET_KEY}
-jwt.secret.time.expiration: ${JWT_TIME_EXPIRATION}
+spring.profiles.active = ${SPRING_PROFILES_ACTIVE}
+#Permite establecer utf8 en la documentación
+server.servlet.encoding.force-response=true
+server.servlet.encoding.charset=UTF-8