Skip to content

Commit

Permalink
TP3: parameterize db credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Webjosse committed Feb 7, 2024
1 parent bba0809 commit e503b7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 0 additions & 4 deletions deployment/database/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
FROM postgres:14.1-alpine

ENV POSTGRES_DB=db \
POSTGRES_USER=usr \
POSTGRES_PASSWORD=pwd

# From "Init database" part
COPY setup-db /docker-entrypoint-initdb.d/
6 changes: 3 additions & 3 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ spring:
generate-ddl: false
open-in-view: true
datasource:
url: jdbc:postgresql://tp1-backend-db:5432/db
username: usr
password: pwd
url: jdbc:postgresql://${POSTGRES_HOST}/${POSTGRES_DB}
username: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
driver-class-name: org.postgresql.Driver
management:
server:
Expand Down
16 changes: 12 additions & 4 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ spring:
lob:
non_contextual_creation: true
generate-ddl: false
open-in-view: true
datasource:
driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver
url: jdbc:tc:postgresql://hostname/simple-api
username: ${embedded.postgresql.user}
password: ${embedded.postgresql.password}
url: jdbc:postgresql://${POSTGRES_HOST}/${POSTGRES_DB}
username: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
driver-class-name: org.postgresql.Driver
management:
server:
add-application-context-header: false
endpoints:
web:
exposure:
include: health,info,env,metrics,beans,configprops

0 comments on commit e503b7a

Please sign in to comment.