Denis
Denis

Reputation: 391

The configuration of my two HealthIndicator is not read

I have coded two HealthIndicator, one CustomHealthIndicator.java implementing the HealthIndicator Java interface, and a own HSMHealthIndicator.java pinging a HSM. When I coded that I put this configuration in application.properties :

management.security.enabled=true
endpoints.health.sensitive=false
endpoints.health.enabled=true
endpoints.health.time-to-live=15000

A couple of days ago my boss moved these keys/values in the application.yml configuration file :

management:
    security:
        enabled: true
endpoints:
    health:
        sensitive: false
        enabled: true
        time-to-live: 15000

Because in our application, contrary to the .properties, the .yml should not be externalised (because it should not be editable by the user, so it is not copied by Maven in the "target" directory during the build).

The problem is that I noticed that the keys/values are not read anymore by my code. Indeed when I connect to http://localhost:8080/health the only thing displayed is :

{"status":"UP"}

whereas I used to have :

{"status":"UP","custom":{"status":"UP"},"diskSpace":{"status":"UP","total":107374178304,"free":25598341120,"threshold":10485760},"db":{"status":"UP","database":"PostgreSQL","hello":1}}

Other evidence : when I connect to my custom endpoint (http://localhost:8080/HSMAndDbHealth) I have now :

The JWT is missing from the 'Authentication'header 

whereas I used to have :

{"code":"UP","message":"Database and HSM are UP"}

Why the keys/value that configure actuators are not read when I put them in application.yml file?

Upvotes: 0

Views: 262

Answers (1)

user3002512
user3002512

Reputation: 399

There might be one or several space characters which are "corrupted". Copy and paste several working keys/values and remplace these keys/value by the keys/value you need.

Upvotes: 1

Related Questions