Alpine icon indicating copy to clipboard operation
Alpine copied to clipboard

Adopt SmallRye Config

Open nscuro opened this issue 1 year ago • 3 comments

Adopts SmallRye Config as underlying configuration provider.

  • Supports loading of properties from multiple sources: https://github.com/stevespringett/Alpine/pull/696/files#diff-4719a77de484039483b05faa389cb04f54716818ccfcacce7b84e40f67ac370eR241-R253
  • Supports expressions: https://github.com/stevespringett/Alpine/pull/696/files#diff-327b5b3f0c14fb274675b66191988c693226f3882e237da69ab5bc9c4b13aa61R194-R203
  • Supports multiple profiles (defaults to prod profile): https://github.com/stevespringett/Alpine/pull/696/files#diff-327b5b3f0c14fb274675b66191988c693226f3882e237da69ab5bc9c4b13aa61R139-R162
  • Supports declarative config mappings: https://github.com/stevespringett/Alpine/pull/696/files#diff-327b5b3f0c14fb274675b66191988c693226f3882e237da69ab5bc9c4b13aa61R95-R111
  • Can be extended by applications to source properties from the database, for example.

A new alpine-test module is introduced to provide helpful functionality to test Alpine-based applications.

It contains an in-memory configuration source, and a JUnit 4 rule using said source to modify configuration properties within the scope of a test: https://github.com/stevespringett/Alpine/pull/696/files#diff-f48b406449780d75cfbcbe1e524bffeca96d349b4f9774e1f5ccd10fec4b09bdR27-R44

Applications do not need to modify environment variables or system properties anymore in order to test different configurations.

This change is backward-compatible.

Closes #695

nscuro avatar Oct 19 '24 20:10 nscuro

@stevespringett Any thoughts on this?

One thing I'm excited about is that this allows us to know where a given property was sourced from (see https://github.com/stevespringett/Alpine/pull/696/files#diff-327b5b3f0c14fb274675b66191988c693226f3882e237da69ab5bc9c4b13aa61R180-R191).

That makes it possible to render certain properties in a UI, and treat them as read-only if they're sourced from an immutable source (i.e. env vars). A "mutable" source that uses Alpine's CONFIGPROPERTY database table is trivial to add.

nscuro avatar Jan 02 '25 13:01 nscuro

That's really interesting. First I've heard of it. But sounds like a good improvement

stevespringett avatar Mar 03 '25 17:03 stevespringett

+1 for this! Sounds promising

jhoward-lm avatar Mar 08 '25 16:03 jhoward-lm

Superseded by https://github.com/DependencyTrack/hyades-apiserver/pull/1193

nscuro avatar Aug 12 '25 16:08 nscuro