-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Hello, I'd like to propose some major changes to this library.
Let me start with the motivation. We need to be able to create SSLContext from Lightbend Config and we have some working code from past but now we wanted to go with something "standard", something used by the others and be compatible with them.
That's how I found this library and was about to use it but then I realised there are some in my opinion weird things in it.
In general, I like this library for being very complex and providing huge configurability, so that's why I even care.
I see following problems:
- Configuration from
Configis bound to using kebab-case however it'd be great if it supports whatever casing the user wants - camelCase, snake_case etc. Currently, the ssl-config configuration just doesn't fit into rest of the application because of this (unless one uses the same casing). BTW I made a seperate issue some time ago related to this. - In general, it's good if one doesn't need to specify all values in the
Configbut the library provides some defaults. ssl-config does it but IMHO in a weird way - it doesn't explicitly merge some defaults when configuring, but defaults are somewhat implicitly (when loadingConfig) IF one holds the convention to put his configuration to same path (ssl-configin root). Strange thing is thatSSLConfigFactory.parsemethod takes anyConfiginstance which kind of collides with the previous thing - in that case one must set all values manually because defaults are not applied; so why to even take theConfiginstance as an input? What I'd expect it to do is actually made manually in tests which kind of emphasizes this existing problem. Everyone needs to do this merging by his own. - This is very related to previous point. By kind of a forcing users to place their config to the same global path in
Config, it's possible to create only a singleSSLContextin whole application, which is very common but can cause some troubles in specific situations.
What I propose is:
- To support different casing, default may remain the current
kebab-case, so backward compatibility. - To support built-in merging of defaults, so noone would be forced to place his config to some predefined place. For older applications, it would work as now, it would just be merged explicitly instead of implicitly (even though inside the library).
- To polish lib's API a little bit, provide more clear entry point with support for different casings. This would not be backward compatible.
I also have in my mind another option, but backward incompatible: to split core of the library and it's configuration into two separate modules where the configuration from Config would by done by some clever library, most probably Pureconfig (potentially by more of them, via multiple modules). I think that even with this variant could be possible to be backward compatible in terms of configuration itself, just entrypoint would be different.
I'm not sure what are all current usages of this library (Akka, Play??) and how much they count with current behavior (e.g. a single global configuration) so I don't want to break anything; however I believe my changes would make the library just better and much more friendly for other potential adopters.
And, as I final note, I'd like to say that I'm willing to implement all changes we will agree about.
Thank you for considering.