From 6025a122535b418b5e339a15f81ddbb05766ecc3 Mon Sep 17 00:00:00 2001 From: Mika Bomm Date: Fri, 30 Aug 2024 18:08:13 +0200 Subject: [PATCH] add postgresql connection to the project and move from application.properties to application.yml --- docker-compose.yml | 1 + server/README.MD | 7 ++++++ server/build.gradle | 1 + .../src/main/resources/application.properties | 1 - server/src/main/resources/application.yml | 22 +++++++++++++++++++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 server/README.MD delete mode 100644 server/src/main/resources/application.properties create mode 100644 server/src/main/resources/application.yml diff --git a/docker-compose.yml b/docker-compose.yml index 67b2bf7..e887a11 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/server/README.MD b/server/README.MD new file mode 100644 index 0000000..4be5f9b --- /dev/null +++ b/server/README.MD @@ -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 + diff --git a/server/build.gradle b/server/build.gradle index f795015..85d7791 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -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' diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties deleted file mode 100644 index 056454e..0000000 --- a/server/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=DocuSphere diff --git a/server/src/main/resources/application.yml b/server/src/main/resources/application.yml new file mode 100644 index 0000000..cbd7549 --- /dev/null +++ b/server/src/main/resources/application.yml @@ -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