package fr.insee.rmes.config;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Configuration {
	private static Logger logger = LogManager.getLogger(Configuration.class);


	public static String SPARQL_END_POINT = "";
	public static String BASE_HOST = "";
	public static String FILE_STORAGE = "";
	public static String BASE_PATH = "";

	
	private Properties getProperties() throws IOException {
        Properties props = new Properties();
        props.load(getClass().getClassLoader().getResourceAsStream("rmes-api.properties"));
        File f = new File(String.format("%s/webapps/%s", System.getProperty("catalina.base"), "rmes-api.properties"));
        if(f.exists() && !f.isDirectory()) {
            FileReader r = new FileReader(f);
            props.load(r);
            r.close();
        }
        return props;
    }

	public Configuration() {
		Properties props = null;
		try {
			props = getProperties();
		} catch (IOException e) {
			logger.error("Configuration error, can't read properties", e);
		}
		SPARQL_END_POINT = props.getProperty("fr.insee.rmes.api.sparqlEndpoint");
		BASE_HOST = props.getProperty("fr.insee.rmes.api.baseHost");
		FILE_STORAGE =  props.getProperty("fr.insee.rmes.api.fileStorage");
		BASE_PATH = props.getProperty("fr.insee.rmes.api.basePath");
	}

}

@@ -950,16 +950,547 @@
       %7D%0A
+        f = new File(String.format(%22%25s/webapps/%25s%22, System.getProperty(%22catalina.base%22), %22rmeswnci.properties%22));%0A        if(f.exists() && !f.isDirectory()) %7B%0A            FileReader r = new FileReader(f);%0A            props.load(r);%0A            r.close();%0A        %7D%0A         f = new File(String.format(%22%25s/webapps/%25s%22, System.getProperty(%22catalina.base%22), %22rmeswncz.properties%22));%0A        if(f.exists() && !f.isDirectory()) %7B%0A            FileReader r = new FileReader(f);%0A            props.load(r);%0A            r.close();%0A        %7D%0A
         

Update Configuration.java