-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Feature/config builder enhacements #1499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/config builder enhacements #1499
Conversation
TBH, I don’t see much value in the changes you suggest. |
Ok, I'll show you my case.
I'm using typesafe config in my scala project. I'd like to have configuration of my http client as follows:
I'm aware that there is But still, there should be a way to dynamically convert typesafe config (or any other lib config) to some abstract/base format which is understandable by asynchttpclient. I've noticed that you use java properties. I can do such conversion (typesafe config -> java properties) on my side. But in async http client there is no way to pass Now my case can be resolved in following way:
And as you see, I don't have to implement |
I’m not telling you to implement it in your project but contribute it as a sub module (see extras directory). An alternative implementation that would take a Config input would surely benefit other people. |
Convertion between typesafe config and java properties can be done with https://github.com/andr83/scalaconfig. But still, to achieve that I need a way to intialialize Builder with Properties instance. So, after my explanations, do you understand my point of view? Does the PR make sense for you now? |
No, I really don't. Instead of adding a new |
Because this solution is more generic and you will be able to initialize AHC with any config lib you use, only by providing generic converter from Then you can add to The only thing I need from AHC is to create Why do you think this is a problem? |
IMO, Typesafe config doesn't have much competitors and is becoming a standard.
There won't ever be an official integration for any Typesafe config Scala wrappers.
Because I don't want to introduce APIs that are not used or don't meet the actual need. My feeling is the actual need is to do |
OK, so, forget about typesafe config. Suppose, I'd like to create java.Properties in runtime and initialize AHC with it. At the moment I cannot do that. I can initialize AHC using file with properties. My solution will allow me to do so. |
We have many applications in java and scala, where we'd like to use AHC. Dynamic initialization at the moment is only one thing which is missing and block us to use it. |
I still fail to understand how having a Config based implementation wouldn't meet your needs. |
Other example: |
Look, if you were to have an AsyncHttpClientConfig implementation that can be built from a
|
ok, so to be clear current solution is not acceptable (honestly, don't understand why, because it uses all mechanisms proposed by you and changes almost nothing). But OK. Will you accept solution providing |
Absolutely |
Ok, will implement it. |
Just came across this. Thanks @coutoPL for proposing My use case is to initialize an The library already have the ability to translate from
|
@sirianni typesafe config is not the standard for you? :P I'm glad that you share my point. I wanted to provide solution that could solve the problem in more generic (standard) way, but we ended up with sth like this: #1500 So, now you have to generate typesafe config from your yaml and feed the ahc or write your own extras-integration :P |
Spring Boot? |
At the moment there is no option for load config from other source than java properties. It would be acceptable if I could convert on fly eg. typesafe config to java properties and apply it while creating Async Http Client instance.
So, I've added
PropertiesAsyncHttpClientConfig
class which implementsAsyncHttpClientConfig
interface and useProperties
instance as a store for settings (with fallback to default ones when some settings aren't set).From now, anyone can use auxiliary Builder constructor and pass to it
PropertiesAsyncHttpClientConfig
object which can be created in runtime fromProperties
class object.