All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.tiler.internal.config.ConfigFactory Maven / Gradle / Ivy

There is a newer version: 0.1.28
Show newest version
package io.tiler.internal.config;

import org.vertx.java.core.json.JsonObject;

public class ConfigFactory {
  public Config load(JsonObject config) {
    return new Config(
      config.getInteger("port"),
      getApiConfig(config),
      getRedisConfig(config));
  }

  private ApiConfig getApiConfig(JsonObject config) {
    JsonObject api = config.getObject("api");

    if (api == null) {
      return new ApiConfig();
    }

    return new ApiConfig(
      api.getBoolean("readOnly"));
  }

  private RedisConfig getRedisConfig(JsonObject config) {
    JsonObject redis = config.getObject("redis");

    if (redis == null) {
      return new RedisConfig();
    }

    return new RedisConfig(
      redis.getString("address"),
      redis.getString("host"),
      redis.getInteger("port"),
      redis.getString("encoding"),
      redis.getBoolean("binary"),
      redis.getString("auth"),
      redis.getInteger("select"),
      redis.getString("keyPrefix"));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy