List of available override the application properties (like database settings) in EHRBase

Hi,
Is there a documentation on the list of application properties for EHRBase that we can override at startup time? Also is there an application.properties file that I can customize and use at runtime?

regards

application/src/main/resources/application.yml is the internal config file

If you are using Docker you can set these various via the .env.ehrbase file in the root folder.

This is mine

SERVER_NODENAME=freshehr.ehrbase.org
SECURITY_AUTHTYPE=BASIC
SECURITY_AUTHUSER=ehrbase-user
SECURITY_AUTHPASSWORD=SuperSecretPassword
SECURITY_AUTHADMINUSER=ehrbase-admin
SECURITY_AUTHADMINPASSWORD=SuperSecretAdminPassword
SYSTEM_ALLOW_TEMPLATE_OVERWRITE=true
ADMINAPI_ACTIVE=true
ADMINAPI_ALLOWDELETEALL=true
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUERURI=
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE=env,health,info,metrics,prometheus
MANAGEMENT_ENDPOINTS_WEB_BASEPATH=/status
MANAGEMENT_ENDPOINT_ENV_ENABLED=false
MANAGEMENT_ENDPOINT_HEALTH_ENABLED=false
MANAGEMENT_ENDPOINT_HEALTH_DATASOURCE_ENABLED=false
MANAGEMENT_ENDPOINT_INFO_ENABLED=false
MANAGEMENT_ENDPOINT_METRICS_ENABLED=false
MANAGEMENT_ENDPOINT_PROMETHEUS_ENABLED=false
MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED=false

2 Likes

Thank Ian,

regards

Where is the database configuration? they are not there in the application/src/main/resources/application.yml file.

If we are copying and running the jar file on another server, where do we place the application.yml file?

regards

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!

Thanks a lot. That helps😀
regards

@ian.mcnicoll @jake.smolka sample environment variable file has this list of management end points

MANAGEMENT_ENDPOINTS_WEB_EXPOSURE=env,health,info,metrics,prometheus

Are these the full list of available management endpoints that EHRBase supports?

Hi Dileep,

have you seen this part of the documentation, yet? 3.8. Status and Metrics — EHRbase documentation

This contains all management/operations endpoints.

Thanks @birger.haarbrandt . Sorry I missed that
regards