private static KeyGeneratorSettings loadSettings(Vertx vertx, Class<? extends IKeyGenerator> defaultClass, String path) throws Exception { FileSystem fs = vertx.fileSystem(); if (fs.existsBlocking(path)) { LOGGER.info("going to load settings from " + path); Buffer buffer = fs.readFileBlocking(path); KeyGeneratorSettings settings = Json.decodeValue(buffer.toString(), KeyGeneratorSettings.class); LOGGER.info("settings successfully loaded from " + path); return settings; } else { LOGGER.info("creating default settings and store them in " + path); KeyGeneratorSettings settings = createDefaultSettings(defaultClass); fs.writeFileBlocking(path, Buffer.buffer(Json.encodePrettily(settings))); String message = String.format( "Settings file did not exist and was created new in path %s. NOTE: edit the file, set edited to true and restart the server", path); throw new InitException(message); } }