Closed dmolesUC closed 6 years ago
I think you can call create
on start
and hold a reference in your Verticle instance. Once loaded you probably can use cachedConfig
for everything else. I guess this take care of previous settings loaded in Verticle
configuration (config()
).
If this is ok you can close the issue ;)
I’m afraid that’s still not clear to me -- neither exactly what I should do, nor why it would work. Is it too much to ask that the documentation show how to use the retrieved configuration?
Sorry, I'm afraid I can not help you with that :(
The documentation page does an excellent job of explaining how to read different types of configurations, but it's not at all clear what to do once you've called
retriever.getConfig()
.The only example I could find on line was this StackOverflow question, which hard-codes everything (
ConfigStoreOptions
,ConfigRetrieverOptions
,ConfigRetriever
) into one verticle'sstart()
method and then constructsDeploymentOptions
for a second verticle.I've literally only been working with Vert.x for a day, so maybe this is more sensible than it sounds, but starting an extra verticle just to read the configuration seems like overkill to me. Alternatively, I could put
ConfigRetriever.create()
etc. directly in thestart()
method of my main verticle, callgetConfig()
there, and make use of the result directly; but this ignoresAbstractVerticle.config()
(i.e., the config coming fromContext
), which seems likely to lead to confusion and errors down the road.It seems like there should be a way to inject the retrieved config into the context, but it's not at all clear what that would be. (Possibly something involving subclassing the
Launcher
?)