Hey @Dileep_V_S! A little background info: Currently our documentation is at a level where we mostly don’t document the things we didn’t build ourselves yet. What I mean with that is that the setting of configuration attributes is completely handled by Spring Boot - the handling is nothing we explicitly implemented. But your post is a good reminder that we need to focus on the complete perspective soon.
To answer your question: As @ian.mcnicoll pointed out, the configuration happens around the application.yml file. As per Spring Boot default there are some mechanisms implied here.
First, there can be different profiles. You can see the local, docker etc. profile here ehrbase/application/src/main/resources at develop · ehrbase/ehrbase · GitHub
Each one takes the application.yml as foundation and just overwrites what ever is set in the corresponding profile’s .yml file. So you can take a look at the .yml files and see the available configurations. Database configuration depends a bit on the profile, so you’ll see the the DB URI in the local profile. But you can overwrite them with the following.
(Note: EHRbase print the used profile in the console output as on of the first lines.)
Second, Spring Boot offers several ways to set the attributes. See our note here ehrbase/application.yml at develop · ehrbase/ehrbase · GitHub
Spring documents those ways and their priority order here: Spring Boot Features
In practice - and in short - this means: environment variables are overwriting application.yml settings.
Together with paradigms like The 12-Factor App using environment variables to overwrite configuration settings is what I would recommend. And as @ian.mcnicoll said, this is what our proposed docker setup is doing with its matching .env file.
If you want to directly use the jar, you can set your environment variables, for instance, Linux command-line style:
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:1234/ehrbase java -jar application-0.16.5.jar
(Or you can export them in a more ordered fashion. But this is OS related.)
If you insist on not using environment variables: Another approach is to place an application-local.yml (depending on the used profile) file next to the .jar and just execute it normally (see the Spring documentation at “Config data files are considered in the following order:”). The file could only contain this:
spring:
datasource:
url: jdbc:postgresql://localhost:1234/ehrbase
I hope that helps!