Skip to main content

Posts

Showing posts from June, 2019

vertx command line parameters

How to pass command line parameters to "vertx run" Context I'm using continuous delivery and need to checkout a git branch then launch the verticle with a parameter. For example: I chekcout the "demo" git branch I deploy it to the target I remotely run the verticle with "vertx run 'demo'" (this actually doesn't work, but it illustrates my needs) The solution: use system environment variables The documentation https://vertx.io/docs/vertx-config/java/ is mentionning it, but it was not straight to me, so here is precisely how I did: package org.rktmb.vertx // ... import io.vertx.config.ConfigStoreOptions; import io.vertx.config.ConfigRetriever; import io.vertx.config.ConfigRetrieverOptions; // ... public class MainVerticle extends SyncVerticle { @Override public void start(Future startFuture) throws Exception { // ... ConfigStoreOptions jsonEnvConfig = new ConfigStoreOptions().setType("env") .se