package ru.yandex.autotests.direct.db;

import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import ru.yandex.autotests.direct.db.configuration.DirectConfiguration;
import ru.yandex.autotests.httpclientlite.HttpClientLite;

/*
* todo javadoc
*/
public class ConfigUtils {
    private static final Map<URI, DirectConfiguration> cache = new HashMap<>();

    public static DirectConfiguration getDirectConfiguration(URI configUrl) {
        return cache.computeIfAbsent(configUrl, uri -> {
            HttpClientLite cli = new HttpClientLite.Builder().getDefault().build();
            return cli.get(uri, DirectConfiguration.class);
        });
    }
}
