lightbend / config

configuration library for JVM languages using HOCON files
https://lightbend.github.io/config/
6.16k stars 967 forks source link

Capability of passing request properties for config.url #765

Open Anatoliy4041 opened 2 years ago

Anatoliy4041 commented 2 years ago

Sometimes configs resides under urls, where some kind of URLConnection request properties configuring capability is required. For example, if we set -Dconfig.url="https://url_here_my_config_is_residing/my_config.conf" and the server requires some kind of authentication, e.g. via Bearer token, it would return Not Found. To tackle it down, we have to set:

connection.setRequestProperty("Authorization", "Bearer ${my_token}")

However, currently, a library consumer is only able to configure accept request property (link).

@havocp and @akka-team wouldn't it be more beneficial to add a capability of passing some kind of Map request properties defined by a library consumer, to be more flexible around configuring underlying URLConnection ? At least to configure Authorization (e.g. -Dconfig.authorization=...)