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
This commit is contained in:
6
.env.example
Normal file
6
.env.example
Normal file
@@ -0,0 +1,6 @@
|
||||
DB_URL=
|
||||
DB_USER=
|
||||
DB_PASSWORD=
|
||||
PORT=
|
||||
SSL_KEYSTORE_PASSWORD=
|
||||
SSL_ENABLED=
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@ target/
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
.env
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
|
||||
10
pom.xml
10
pom.xml
@@ -48,6 +48,16 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -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
|
||||
|
||||
15
src/test/resources/application.properties
Normal file
15
src/test/resources/application.properties
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user