    public static void main(String[] args) throws Exception{
    	LOG = LoggerFactory.getLogger(Main.class);
    	AppProperties.loadProperties();
        String webappDirLocation = "src/main/webapp/";
        boolean heroku = false;
        String basedir = (String)System.getProperty("basedir");
        if (basedir != null && basedir.endsWith("/app/target")) {
            heroku = true;
        }
        System.setProperty("java.naming.factory.url","org.eclipse.jetty.jndi");
		System.setProperty("java.naming.factory.initial","org.eclipse.jetty.jndi.InitialContextFactory");
        String webPort = System.getenv("PORT");
        if(webPort == null || webPort.isEmpty()) {
            webPort = "8080";
        }		
        Server server = new Server(Integer.valueOf(webPort));
        if(!heroku) {
        	LOG.info("Seems to be running locally, setup some SSL stuff");
	        String sslPort = System.getenv("SSLPORT");
	        if(sslPort == null || sslPort.isEmpty()) {
	            sslPort = System.getenv("SSL_PORT");
	            if(sslPort == null || sslPort.isEmpty()) {
	                sslPort = "8443";
	            }
	        }
	        SocketConnector connector = new SocketConnector();
	        connector.setPort(Integer.valueOf(webPort));
	        SslSocketConnector sslConnector = new SslSocketConnector();
	        sslConnector.setPort(Integer.valueOf(sslPort));
	        sslConnector.setKeyPassword("123456");
	        sslConnector.setKeystore("keystore");
	        server.setConnectors(new Connector[] { sslConnector, connector });        
        } else {
            LOG.info("Looks like we are running on heroku.");
        }
        WebAppContext root = new WebAppContext();
        root.setConfigurationClasses(configClasses);
        root.setContextPath("/");
        root.setDescriptor(webappDirLocation+"/WEB-INF/web.xml");
        root.setResourceBase(webappDirLocation);
        root.setAttribute("mainDS", getJNDIResource());
        root.setParentLoaderPriority(true);
        server.setHandler(root);
        server.start();
        server.join();   
    }

    public static void main(String[] args) throws Exception{
    	LOG = LoggerFactory.getLogger(Main.class);
    	AppProperties.loadProperties();
        String webappDirLocation = "src/main/webapp/";
        boolean heroku = false;
        String basedir = (String)System.getProperty("DATABASE_URL");
        if (basedir != null) {
            heroku = true;
        }
        System.setProperty("java.naming.factory.url","org.eclipse.jetty.jndi");
		System.setProperty("java.naming.factory.initial","org.eclipse.jetty.jndi.InitialContextFactory");
        String webPort = System.getenv("PORT");
        if(webPort == null || webPort.isEmpty()) {
            webPort = "8080";
        }		
        Server server = new Server(Integer.valueOf(webPort));
        if(!heroku) {
        	LOG.info("Seems to be running locally, setup some SSL stuff");
	        String sslPort = System.getenv("SSLPORT");
	        if(sslPort == null || sslPort.isEmpty()) {
	            sslPort = System.getenv("SSL_PORT");
	            if(sslPort == null || sslPort.isEmpty()) {
	                sslPort = "8443";
	            }
	        }
	        SocketConnector connector = new SocketConnector();
	        connector.setPort(Integer.valueOf(webPort));
	        SslSocketConnector sslConnector = new SslSocketConnector();
	        sslConnector.setPort(Integer.valueOf(sslPort));
	        sslConnector.setKeyPassword("123456");
	        sslConnector.setKeystore("keystore");
	        server.setConnectors(new Connector[] { sslConnector, connector });        
        } else {
            LOG.info("Looks like we are running on heroku.");
        }
        WebAppContext root = new WebAppContext();
        root.setConfigurationClasses(configClasses);
        root.setContextPath("/");
        root.setDescriptor(webappDirLocation+"/WEB-INF/web.xml");
        root.setResourceBase(webappDirLocation);
        root.setAttribute("mainDS", getJNDIResource());
        root.setParentLoaderPriority(true);
        server.setHandler(root);
        server.start();
        server.join();   
    }
