Skip to content

fix(config): Tolerate malformed lines in the generated .env - #115

Merged
ebouchut merged 1 commit into
devfrom
fix/dotenv-env-header
Jul 27, 2026
Merged

fix(config): Tolerate malformed lines in the generated .env#115
ebouchut merged 1 commit into
devfrom
fix/dotenv-env-header

Conversation

@ebouchut

@ebouchut ebouchut commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Problem

Starting the app with make run died before Spring even began:

DotenvException: Malformed entry

Issue

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 thatline, but dotenv-java rejects it,
and spring-dotenv aborts the whole startup.

The issue seems related to localization.

Workaround

The header generation is an upstream issue.
The workaround is to set springdotenv.ignore-if-malformed to true to make the loader skip
non KEY=VALUE lines instead of failing, so every real variable still loads whatever the header locale looks like.

Long Term Fix

Filed a ticket on the external secrets manager for this upstream issue to be fixed.

Starting the app with make run died before Spring even began:

  DotenvException: Malformed entry <header documentation URL>

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).
@ebouchut ebouchut self-assigned this Jul 27, 2026
@ebouchut ebouchut added bug Something isn't working security dependencies config backend auth Authentication & authorization (login, sessions, password reset, tokens) labels Jul 27, 2026
@ebouchut ebouchut moved this to In Review in learn-dev-project Jul 27, 2026
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.33%. Comparing base (0aa8a66) to head (89b56f8).

Additional details and impacted files
@@            Coverage Diff            @@
##                dev     #115   +/-   ##
=========================================
  Coverage     80.33%   80.33%           
  Complexity      186      186           
=========================================
  Files            38       38           
  Lines           783      783           
  Branches         42       42           
=========================================
  Hits            629      629           
  Misses          124      124           
  Partials         30       30           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ebouchut ebouchut added this to the v1.0- Certification - DWWM milestone Jul 27, 2026
@ebouchut
ebouchut merged commit 47af933 into dev Jul 27, 2026
7 checks passed
@ebouchut
ebouchut deleted the fix/dotenv-env-header branch July 27, 2026 12:24
@github-project-automation github-project-automation Bot moved this from In Review to Done in learn-dev-project Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Authentication & authorization (login, sessions, password reset, tokens) backend bug Something isn't working config dependencies security

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant