apoc.ApocConfiguration Maven / Gradle / Ivy
package apoc;
import apoc.cache.Static;
import apoc.metrics.Metrics;
import apoc.util.Util;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.internal.GraphDatabaseAPI;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Pattern;
/**
* @author mh
* @since 19.05.16
*/
public class ApocConfiguration {
public static final String PREFIX = "apoc.";
private static final Pattern SKIP = Pattern.compile("(ur[il]|pass|cred)",Pattern.CASE_INSENSITIVE);
private static Map apocConfig = new HashMap<>(10);
private static Map config = new HashMap<>(32);
private static final Map PARAM_WHITELIST = new HashMap<>(2);
static {
PARAM_WHITELIST.put("dbms.security.allow_csv_import_from_file_urls", "import.file.allow_read_from_filesystem");
// Contains list of all dbms.directories.* settings supported by Neo4j.
for(String directorySetting : Metrics.NEO4J_DIRECTORY_CONFIGURATION_SETTING_NAMES) {
PARAM_WHITELIST.put(directorySetting, directorySetting);
}
}
public static void initialize(GraphDatabaseAPI db) {
Static.clear();
Config neo4jConfig = db.getDependencyResolver().resolveDependency(Config.class);
Map params = neo4jConfig.getRaw();
apocConfig.clear();
apocConfig.putAll(Util.subMap(params, PREFIX));
PARAM_WHITELIST.forEach((k, v) -> {
Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy