From 7f1aca8c09a71fba0120b7490c77b1b32eee08d4 Mon Sep 17 00:00:00 2001 From: Carlos Gutierrez Date: Sun, 18 Jan 2026 17:00:19 -0500 Subject: [PATCH] fix: fixing the issue on the initialization of the web application Adding .env.example for environment variable management Updating .gitignore to exclude sensitive files Modifying pom.xml to include new dependencies Updating application.properties for better configuration --- .env.example | 6 ++++++ .gitignore | 1 + pom.xml | 10 ++++++++++ src/main/resources/application.properties | 18 ++++++++++++++++++ src/test/resources/application.properties | 15 +++++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 .env.example create mode 100644 src/test/resources/application.properties diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5c34931 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +DB_URL= +DB_USER= +DB_PASSWORD= +PORT= +SSL_KEYSTORE_PASSWORD= +SSL_ENABLED= diff --git a/.gitignore b/.gitignore index 685b1a9..ac33462 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ target/ !**/src/main/**/target/ !**/src/test/**/target/ +.env ### STS ### .apt_generated .classpath diff --git a/pom.xml b/pom.xml index df3d832..83a8fe9 100644 --- a/pom.xml +++ b/pom.xml @@ -48,6 +48,16 @@ spring-boot-starter-test test + + com.h2database + h2 + test + + + org.springframework.security + spring-security-test + test + diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 009783b..4fea9c7 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,19 @@ spring.application.name=application + +# HTTPS in production +server.port=${PORT:8443} +server.ssl.enabled=${SSL_ENABLED:true} +server.ssl.key-store=classpath:keystore.p12 +server.ssl.key-store-type=PKCS12 +server.ssl.key-store-password=${SSL_KEYSTORE_PASSWORD} + +# PostgreSQL Database +spring.datasource.url=${DB_URL} +spring.datasource.driver-class-name=org.postgresql.Driver +spring.datasource.username=${DB_USER} +spring.datasource.password=${DB_PASSWORD} + +# JPA/Hibernate Configuration +spring.jpa.hibernate.ddl-auto=update +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties new file mode 100644 index 0000000..b3507cb --- /dev/null +++ b/src/test/resources/application.properties @@ -0,0 +1,15 @@ +spring.application.name=application + +# No HTTPS in tests +server.ssl.enabled=false + +# H2 In-Memory Database for tests +spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= + +# JPA/Hibernate Configuration for H2 +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.show-sql=false +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect