List of usage examples for io.vertx.core.json JsonObject JsonObject
public JsonObject()
From source file:examples.ConfigExamples.java
License:Apache License
public void env3() { ConfigStoreOptions json = new ConfigStoreOptions().setType("env") .setConfig(new JsonObject().put("keys", new JsonArray().add("SERVICE1_HOST").add("SERVICE2_HOST"))); }
From source file:examples.ConfigExamples.java
License:Apache License
public void http() { ConfigStoreOptions http = new ConfigStoreOptions().setType("http") .setConfig(new JsonObject().put("host", "localhost").put("port", 8080).put("path", "/A")); }
From source file:examples.ConfigExamples.java
License:Apache License
public void http2() { ConfigStoreOptions http = new ConfigStoreOptions().setType("http").setConfig(new JsonObject() .put("defaultHost", "localhost").put("defaultPort", 8080).put("ssl", true).put("path", "/A")); }
From source file:examples.ConfigExamples.java
License:Apache License
public void eb() { ConfigStoreOptions eb = new ConfigStoreOptions().setType("event-bus") .setConfig(new JsonObject().put("address", "address-getting-the-conf")); }
From source file:examples.ConfigExamples.java
License:Apache License
public void dir() { ConfigStoreOptions dir = new ConfigStoreOptions().setType("directory") .setConfig(new JsonObject().put("path", "config").put("filesets", new JsonArray().add(new JsonObject().put("pattern", "dir/*json")).add( new JsonObject().put("pattern", "dir/*.properties").put("format", "properties")))); ConfigStoreOptions dirWithRawData = new ConfigStoreOptions().setType("directory") .setConfig(new JsonObject().put("path", "config").put("filesets", new JsonArray().add(new JsonObject().put("pattern", "dir/*json")) .add(new JsonObject().put("pattern", "dir/*.properties").put("format", "properties") .put("raw-data", true)))); }
From source file:examples.ConfigExamples.java
License:Apache License
public void propsWithRawData() { ConfigStoreOptions propertyWithRawData = new ConfigStoreOptions().setFormat("properties").setType("file") .setConfig(new JsonObject().put("path", "raw.properties").put("raw-data", true)); }
From source file:examples.ConfigExamples.java
License:Apache License
public void propsWitHierarchicalStructure() { ConfigStoreOptions propertyWitHierarchical = new ConfigStoreOptions().setFormat("properties") .setType("file") .setConfig(new JsonObject().put("path", "hierarchical.properties").put("hierarchical", true)); ConfigRetrieverOptions options = new ConfigRetrieverOptions().addStore(propertyWitHierarchical); ConfigRetriever configRetriever = ConfigRetriever.create(Vertx.vertx(), options); configRetriever.configStream().handler(config -> { String host = config.getJsonObject("server").getString("host"); Integer port = config.getJsonObject("server").getInteger("port"); JsonArray multiple = config.getJsonObject("multiple").getJsonArray("values"); for (int i = 0; i < multiple.size(); i++) { Integer value = multiple.getInteger(i); }/*from w w w . j a v a 2 s .c o m*/ }); }
From source file:examples.ConfigExamples.java
License:Apache License
public void consul() { ConfigStoreOptions consul = new ConfigStoreOptions().setType("consul") .setConfig(new JsonObject().put("prefix", "foo")); }
From source file:examples.ConfigGitExamples.java
License:Apache License
public void example1(Vertx vertx) { ConfigStoreOptions git = new ConfigStoreOptions().setType("git") .setConfig(new JsonObject().put("url", "https://github.com/cescoffier/vertx-config-test.git") .put("path", "local") .put("filesets", new JsonArray().add(new JsonObject().put("pattern", "*.json")))); ConfigRetriever retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(git)); }
From source file:examples.ConfigHoconExamples.java
License:Apache License
public void example1(Vertx vertx) { ConfigStoreOptions store = new ConfigStoreOptions().setType("file").setFormat("hocon") .setConfig(new JsonObject().put("path", "my-config.conf")); ConfigRetriever retriever = ConfigRetriever.create(vertx, new ConfigRetrieverOptions().addStore(store)); }