Search in sources :

Example 1 with ConfigConstants

use of io.georocket.constants.ConfigConstants in project georocket by georocket.

the class GeoRocket method overwriteWithEnvironmentVariables.

/**
 * Match every environment variable against the config keys from
 * {{@link ConfigConstants#getConfigKeys()}} and save the found values using
 * the config key in the config object.
 * @param conf the config object
 * @param env the map with the environment variables
 */
static void overwriteWithEnvironmentVariables(JsonObject conf, Map<String, String> env) {
    Map<String, String> names = ConfigConstants.getConfigKeys().stream().collect(Collectors.toMap(s -> s.toUpperCase().replace(".", "_"), Function.identity()));
    env.forEach((key, val) -> {
        String name = names.get(key.toUpperCase());
        if (name != null) {
            Object newVal = toJsonType(val);
            conf.put(name, newVal);
        }
    });
}
Also used : DecodeException(io.vertx.core.json.DecodeException) HttpServer(io.vertx.core.http.HttpServer) Router(io.vertx.ext.web.Router) Function(java.util.function.Function) IndexerVerticle(io.georocket.index.IndexerVerticle) LoggerFactory(io.vertx.core.logging.LoggerFactory) Yaml(org.yaml.snakeyaml.Yaml) HashSet(java.util.HashSet) BooleanUtils(org.apache.commons.lang.BooleanUtils) Single(rx.Single) PemKeyCertOptions(io.vertx.core.net.PemKeyCertOptions) Map(java.util.Map) JsonObject(io.vertx.core.json.JsonObject) RxJavaHooks(rx.plugins.RxJavaHooks) Logger(io.vertx.core.logging.Logger) GeneralEndpoint(io.georocket.http.GeneralEndpoint) JsonUtils(io.georocket.util.JsonUtils) ObservableFuture(io.vertx.rx.java.ObservableFuture) Vertx(io.vertx.core.Vertx) Set(java.util.Set) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) Verticle(io.vertx.core.Verticle) Collectors(java.util.stream.Collectors) Future(io.vertx.core.Future) File(java.io.File) JsonArray(io.vertx.core.json.JsonArray) Endpoint(io.georocket.http.Endpoint) DeploymentOptions(io.vertx.core.DeploymentOptions) AbstractVerticle(io.vertx.core.AbstractVerticle) StoreEndpoint(io.georocket.http.StoreEndpoint) RxHelper(io.vertx.rx.java.RxHelper) HttpServerOptions(io.vertx.core.http.HttpServerOptions) MetadataVerticle(io.georocket.index.MetadataVerticle) ConfigConstants(io.georocket.constants.ConfigConstants) JsonObject(io.vertx.core.json.JsonObject)

Aggregations

ConfigConstants (io.georocket.constants.ConfigConstants)1 Endpoint (io.georocket.http.Endpoint)1 GeneralEndpoint (io.georocket.http.GeneralEndpoint)1 StoreEndpoint (io.georocket.http.StoreEndpoint)1 IndexerVerticle (io.georocket.index.IndexerVerticle)1 MetadataVerticle (io.georocket.index.MetadataVerticle)1 JsonUtils (io.georocket.util.JsonUtils)1 AbstractVerticle (io.vertx.core.AbstractVerticle)1 DeploymentOptions (io.vertx.core.DeploymentOptions)1 Future (io.vertx.core.Future)1 Verticle (io.vertx.core.Verticle)1 Vertx (io.vertx.core.Vertx)1 HttpServer (io.vertx.core.http.HttpServer)1 HttpServerOptions (io.vertx.core.http.HttpServerOptions)1 DecodeException (io.vertx.core.json.DecodeException)1 JsonArray (io.vertx.core.json.JsonArray)1 JsonObject (io.vertx.core.json.JsonObject)1 Logger (io.vertx.core.logging.Logger)1 LoggerFactory (io.vertx.core.logging.LoggerFactory)1 PemKeyCertOptions (io.vertx.core.net.PemKeyCertOptions)1