Closed informedgut closed 6 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.
@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.
The configuration has been updated with an example.
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.)