Skip to content

Multiline values Failed #77

@kingg22

Description

@kingg22

Context:

  • Spring boot 3.3.3
  • Java JDK 21
  • Maven 3.9.5
  • Spring dotenv 4.0.0

What happened?
Using a .env file I put my rsa key in the form JWT_PRIVATE="-----BEGIN PRIVATE KEY-----
......
-----END PRIVATE KEY-----"
and the error occurs:

14:29:57.810 [main] ERROR org.springframework.boot.SpringApplication -- Application run failed
io.github.cdimascio.dotenv.DotenvException: Malformed entry

I ran with ' ', with \n and the only solution I found was to use PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nKh9NV...\n-----END RSA PRIVATE KEY-----\n" as the dotenv faq says.

I report it here since the error indicates the exception from here and not spring dotenv.
Captura de pantalla 2024-09-13 144009
With \n and ' '
Captura de pantalla 2024-09-13 144044

In this you can see that when using JWT_PRIVATE as a long string it does pass and the error is the following JWT_PUBLIC
Captura de pantalla 2024-09-13 144120

Attentive to your response or solution. Thanks for all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions