From 89b56f8db599fcedd4b57c86ac7503c9942abb53 Mon Sep 17 00:00:00 2001 From: Eric Bouchut Date: Sat, 25 Jul 2026 07:46:56 +0200 Subject: [PATCH] fix(config): Tolerate malformed lines in the generated .env Starting the app with make run died before Spring even began: DotenvException: Malformed entry
The .env served by the external secrets manager carries a localized header, and some locales wrap the header's documentation URL onto a bare line without the leading comment mark. Docker Compose skips that line, but dotenv-java rejects it and spring-dotenv aborts the whole startup. The header generation is an upstream issue; on our side springdotenv.ignore-if-malformed now makes the loader skip non KEY=VALUE lines instead of failing, so every real variable still loads whatever the header locale looks like. Verified: the same environment that reproduced the exception boots to "Started LearnDevApplication", and the suite stays green (62 tests). --- src/main/resources/application.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 3fe41a1..ffc8eab 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,3 +1,14 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# spring-dotenv (.env loader) +# The external secrets manager that generates .env prepends a localized +# header, and some locales wrap the header's documentation URL onto a +# bare, uncommented line, which dotenv-java rejects as a "Malformed +# entry" and aborts startup. Tolerate non KEY=VALUE lines: real +# variables still load, bogus header lines are skipped. +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +springdotenv: + ignore-if-malformed: true + spring: application: name: learn-dev