How to delete templates?

Following the guide, I uploaded a template to my local server. Now I would like to delete it but I can’t find the delete on the Restapi.

It on the admin ali Admin API | EHRbase Docs

2 Likes

Please see Admin API | EHRbase Docs

Be aware that you need to enable the Admin API. Please see ehrbase/configuration/src/main/resources/application.yml at develop · ehrbase/ehrbase · GitHub for available parameters.

Please see also List of available override the application properties (like database settings) in EHRBase how to overwrite configurations when using Docker.

2 Likes

Thank you for the clarification. I am using Docker, where can I find the application.yml file? I apologize in advance for the basic questions, but I am still inexperienced.

of note here in the config you see

template:
    # Allows to override templates using POST
    allow-overwrite: false

We routinely set this to true in non-production settings to more easily delete and overwrite templates in development.

If you are using Docker-compose, you can setup a .env file in the same folder which will overwrite the default settings

SERVER_NODENAME=freshehr.ehrbase.org
SYSTEM_ALLOW_TEMPLATE_OVERWRITE=true
ADMINAPI_ACTIVE=true
1 Like

I can’t find the application.yml file, so I don’t understand which folder I should put the .env file in. What can I do? Thanks in advance.

Hi Alex,

You cannot access the application.yml file directly as it lives inside the Docker container, but you can override some of the settings via Environment variables.

To do this create a file called .env.ehrbase alin the same folder as the docker-compose.yml file and add these items (our preference) - you can change the SERVER_NODENAME you whatever you prefer.

SERVER_NODENAME=ehrbase.freshehr.com
SECURITY_AUTHTYPE=BASIC
SECURITY_AUTHUSER=ehrbase-user
SECURITY_AUTHPASSWORD=SuperSecretPassword
SECURITY_AUTHADMINUSER=ehrbase-admin
SECURITY_AUTHADMINPASSWORD=EvenMoreSecretPassword
SECURITY_OAUTH2USERROLE=USER
SECURITY_OAUTH2ADMINROLE=ADMIN
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUERURI=
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE=env,health,info,metrics,prometheus
MANAGEMENT_ENDPOINTS_WEB_BASEPATH=/management
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
SYSTEM_ALLOW_TEMPLATE_OVERWRITE=true
ADMINAPI_ACTIVE=true

If you look at the Ddocker-compose .yml file you will see that it contains the lines

    env_file:
      - .env.ehrbase

This is what tells the Docker container where to find your environment variables.