Move db URL params such that the database engine is set statically, not in the URL (#2)

Enforces the jdbc:engine rather than letting anything be specified in the environment variable. This also helps prevent errors if one were to provided EG a postgres jdbc connection string in the MYSQL_URL variable as the application runs some bootstrapping scripts depending on the database value.
This commit is contained in:
Taylor Becker 2024-03-01 11:02:07 -05:00 committed by GitHub
parent 251816281d
commit 8d10871531
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -1,6 +1,6 @@
# database init, supports mysql too
database=mysql
spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/petclinic}
spring.datasource.url=jdbc:mysql://${MYSQL_URL:localhost/petclinic}
spring.datasource.username=${MYSQL_USER:petclinic}
spring.datasource.password=${MYSQL_PASS:petclinic}
# SQL is written to be idempotent so this is safe

View file

@ -1,5 +1,5 @@
database=postgres
spring.datasource.url=${POSTGRES_URL:jdbc:postgresql://localhost/petclinic}
spring.datasource.url=jdbc:postgresql://${POSTGRES_URL:localhost/petclinic}
spring.datasource.username=${POSTGRES_USER:petclinic}
spring.datasource.password=${POSTGRES_PASS:petclinic}
# SQL is written to be idempotent so this is safe