add postgresql connection to the project and move from application.properties to application.yml

This commit is contained in:
Mika Bomm 2024-08-30 18:08:13 +02:00
parent d3c22fe3a9
commit 6025a12253
5 changed files with 31 additions and 1 deletions

View file

@ -3,6 +3,7 @@ services:
container_name: postgres
image: postgres
environment:
POSTGRES_DB: docusphere
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
PGDATA: /data/postgres

7
server/README.MD Normal file
View file

@ -0,0 +1,7 @@
# Some additional things to consider:
## .env not being read by application.yml
There is currently not a way that environment variables are read from the .env file which the docker-compose.yml file uses.
You have to manually set the environment variables in e.g. your IDE

View file

@ -19,6 +19,7 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

View file

@ -1 +0,0 @@
spring.application.name=DocuSphere

View file

@ -0,0 +1,22 @@
spring:
application:
name: DocuSphere
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/docusphere
username: ${DB_USER}
password: ${DB_PASSWORD}
jpa:
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
format_sql: true
logging:
level:
org.hibernate.SQL: debug
org.hibernate.type.descriptor.sql.BasicBinder: trace