vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Allow configuring of the Vertx instance itself #24

Closed informedgut closed 6 years ago

informedgut commented 7 years ago

I don't know how you'd pull this off since Vertx Config requires a Vertx Instance, hence the chicken-or-egg situation. What I've done as a workaround is have an initial ConfigRetriever that uses a temp Vertx instance. It does the initial retrieve and then I configure Vertx using the properties from there. Then, I close the ConfigRetriever and create a new one that uses the new and configured Vertx instance. It's the one used for subsequent retrievals, both manual and auto-scans.

Thanks and good luck. :)

(This is a follow-up to #23.)

cazacugmihai commented 7 years ago

You can extend Launcher, load the configuration (e.g.: a yaml config file) and inject it into Vertx configuration but it looks more like a hack. It would be nice to have this behavior supported by the Vertx itself.

InfoSec812 commented 6 years ago

@cazacugmihai Except to use the ConfigRetriever you need an instance of Vertx. For the methods in Launcher where the Vertx instance is available, there is no way to set the config directly. You would have to use something like:

vertx.getOrCreateContext().config().mergeIn(newConfig);

But that COULD be problematic depending on how you are starting/configuring your application.

cescoffier commented 6 years ago

The configuration has been updated with an example.