package cz.moneta.test.harness.connectors.common;

import cz.moneta.test.harness.config.ConfigProvider;
import cz.moneta.test.harness.context.ConfigAccessor;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ServletConfigAccessor implements ConfigAccessor {

    private final Map<String, String> config = new ConcurrentHashMap<>(ConfigProvider.readConfig());

    @Override
    public String getConfig(String key) {
        return config.get(key);
    }

    @Override
    public String getConfig(String key, String defaultValue) {
        return config.getOrDefault(key, defaultValue);
    }

    @Override
    public void putConfig(String key, String value) {
        config.put(key, value);
    }
}
