blob: c9d8536122e2f8aa9f8a5fb5ef6e9bad53279ccd [file] [log] [blame]
package org.eclipse.openk.elogbook.common;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import org.apache.log4j.Logger;
public class InitBackendConfig extends HttpServlet {
private static final long serialVersionUID = -7882117179312471533L;
private static final Logger LOGGER = Logger.getLogger(InitBackendConfig.class.getName());
@Override
public void init() throws ServletException {
String environment= getServletContext().getInitParameter("OK_ELOGBOOK_ENVIRONMENT");
if (environment == null){
environment = "Production";
}
String configFile = "";
switch (environment){
case "DevLocal":
configFile="backendConfigDevLocal.json";
break;
case "DevServer":
configFile="backendConfigDevServer.json";
break;
case "Custom":
configFile="backendConfigCustom.json";
break;
default:
configFile="backendConfigProduction.json";
}
BackendConfig.setConfigFileName(configFile);
LOGGER.info("Elogbook backendendenviroment is: " +environment+ ". Setting config accordingly to: "+ configFile);
}
}