avaje / avaje-config

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

Support TOML? #94

Open SentryMan opened 9 months ago

SentryMan commented 9 months ago

I like how it looks.

Mechite commented 9 months ago

I personally dislike TOML due to syntactical complexity WRT things like arrays (will always be a controversial opinion). However, if you would undertake this I would imagine you would prefer not to have a dependency on a seperate parsing library.

In this case, I would take a look at night-config as they have their own parsing implementations and zero dependencies as a result, and it has worked fine for years already.

On the plus side, you can support formats like HOCON too if you like their parsing system, forking this parsing implementation would lead to a tiny file size increase for avaje-config as a whole while allowing more formats to be supported.

SentryMan commented 9 months ago

I was thinking more of creating a separate module for the different formats

Mechite commented 9 months ago

I was thinking more of creating a separate module for the different formats

If this then perhaps also add support for users to create their own parsers.

Also, probably an implementation of dotenv would be simple and useful, considering dotenv-java does it in one file, <100 LOC. I did dotenv myself in the past by parsing with Properties. The formats are almost identical.

proposed module structure?

im proposing here a LOT of formats, don't know if it fits the scope to support a lot of formats

light overview of syntactical differences between dotenv and properties

I looked at the differences a few years ago, didn't think much of it and implemented Properties for parsing .env files in order to make the JS guys happy. These projects are still in service, not sure if any custom logic is to be written when we can just add support for reading the file extension (in current working directory, search for *.env or just env)

SentryMan commented 9 months ago

That recent pr adds support for custom parsers

SentryMan commented 9 months ago

im proposing here a LOT of formats, don't know if it fits the scope to support a lot of formats

it probably does, but you won't find me writing a parser for them unless somebody actually needs one