avaje / avaje-config

Application configuration / properties loading for JVM applications
https://avaje.io/config
Apache License 2.0
47 stars 7 forks source link

#81 Adjust load ordering of profiles #83

Closed rbygrave closed 1 year ago

rbygrave commented 1 year ago

Config generally loads RESOURCE source first, and FILE source later. This allows the FILE source properties to override the RESOURCE source properties in a predictable manner.

rbygrave commented 1 year ago

ok, pretty sure this isn't quite right. There are 2 cases it doesn't quite do the "right thing".

  1. FILE application.properties specifies config.profiles -> the RESOURCEs are not loaded at all
  2. FILE application.properties specifies ADDITIONAL profiles in config.profiles -> the ADDITIONAL RESOURCEs are not loaded

I think the 2 options for improving this are: A) RESOURCE for profiles is loaded after loadMain(FILE) which is the original ordering before this PR B) Keep track of profile RESOURCE that are loaded, after loadMain(FILE) then any profile RESOURCE not already previously loaded is loaded

Both of these options solve those 2 issues above. Hmm, pondering ... but maybe leaning towards option B.