From 051af6d293500d4d4540145c00393e4a0643e33d Mon Sep 17 00:00:00 2001 From: vilar Date: Wed, 17 Dec 2025 18:19:22 +0500 Subject: [PATCH] feat: created dev and prod properties, changed main properties for work with profiles --- src/main/resources/application-dev.properties | 9 +++++++++ src/main/resources/application-prod.properties | 9 +++++++++ src/main/resources/application.properties | 10 +++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/application-dev.properties create mode 100644 src/main/resources/application-prod.properties diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties new file mode 100644 index 000000000..eb0401ab7 --- /dev/null +++ b/src/main/resources/application-dev.properties @@ -0,0 +1,9 @@ +# database init, supports postgres too +database=postgres +spring.datasource.url=${POSTGRES_URL:jdbc:postgresql://localhost:5433/petclinic_dev} +spring.datasource.username=${POSTGRES_USER:petclinic} +spring.datasource.password=${POSTGRES_PASS:petclinic} +# SQL is written to be idempotent so this is safe +spring.sql.init.mode=always + +spring.liquibase.contexts=dev diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties new file mode 100644 index 000000000..8f0285f2d --- /dev/null +++ b/src/main/resources/application-prod.properties @@ -0,0 +1,9 @@ +# database init, supports postgres too +database=postgres +spring.datasource.url=${POSTGRES_URL:jdbc:postgresql://localhost:5432/petclinic} +spring.datasource.username=${POSTGRES_USER:petclinic} +spring.datasource.password=${POSTGRES_PASS:petclinic} +# SQL is written to be idempotent so this is safe +spring.sql.init.mode=always + +spring.liquibase.contexts=prod diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 6ed985654..ec2337454 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,11 @@ # database init, supports mysql too -database=h2 -spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql -spring.sql.init.data-locations=classpath*:db/${database}/data.sql +database=dev +spring.profiles.active=${database} +# spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql +# spring.sql.init.data-locations=classpath*:db/${database}/data.sql + +spring.liquibase.change-log=classpath:db/changelog/db.changelog-master.xml + # Web spring.thymeleaf.mode=HTML