paulschwarz / spring-dotenv

Provides a Dotenv property source for Spring
MIT License
301 stars 23 forks source link

Support relaxed bindings for acting like SystemEnvironmentPropertySource #16

Open glandais opened 1 year ago

glandais commented 1 year ago

This will allow to use variable with an indirection in Spring properties

paulschwarz commented 1 year ago

Note to self: https://github.com/spring-projects/spring-boot/wiki/Relaxed-Binding-2.0

natrem commented 10 months ago

@paulschwarz I'm willing to give it a try.

One important note when comparing SystemEnvironmentPropertySource with the official documentation is that SystemEnvironmentPropertySource supports for namings.

For instance, based on the doc, my-app.component.long-property should map to environment MYAPP_COMPONENT_LONGPROPERTY

Based on the implementation (which is straightforward to replicate with tests), you would support

It would be quite easy to look for the MYAPP_COMPONENT_LONGPROPERTY only.

Considering readability (and easiness to replicate spring code), I suggest to tolerate:

Do you have a preference?

note1: I made a quick and dirty wrap around your library and it works fine for a simple case. note 2: looking for documented name in spring boot for system properties is done through class SpringConfigurationPropertySource