Index: src/webservice/htdocs/404.html
===================================================================
--- src/webservice/htdocs/404.html	(revision db3869689166c7f2f4ad48f564ba1e317cc5e531)
+++ 	(revision )
@@ -1,8 +1,0 @@
-<html>
-	<head>
-		<title>URL not found</title>
-	</head>
-	<body>
-		<h1>URL not found</h1>
-	</body>
-</html>
Index: src/webservice/htdocs/SiWeather/Webservice/Setup.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/Setup.php	(revision db3869689166c7f2f4ad48f564ba1e317cc5e531)
+++ src/webservice/htdocs/SiWeather/Webservice/Setup.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -306,11 +306,5 @@
 	
 	public function apiCheckWithRewrite(&$errorMessage){
-		$apiVersion = $this->_webserviceConfig->getConfig("webserviceApiVersion");
-		if(!$apiVersion || empty($apiVersion)){
-			$errorMessage = _("Could not determine API version");
-			return false;
-		}
-		
-		return $this->apiCheck($apiVersion ."/stations", $errorMessage);
+		return $this->apiCheck("stations", $errorMessage);
 	}
 
@@ -326,5 +320,5 @@
 	
 	private function apiCheck($url, &$errorMessage){
-		$baseUrl = $this->_webserviceConfig->getConfig("webserviceBaseUrl");
+		$baseUrl = $this->_webserviceConfig->webserviceBaseUrl();
 		if(!$baseUrl || empty($baseUrl)){
 			$errorMessage = _("No webservice base url given!");
@@ -332,4 +326,5 @@
 		}
 
+		# base_url needs to end with a /, otherwise the last element is chopped
 		$client = new \GuzzleHttp\Client
 		(
@@ -347,5 +342,5 @@
 		$result = $response->getStatusCode();
 		if($result != 200){
-			$errorMessage = \Translator::swGettext("Got http error %s (%s)", $result, $response->getReasonPhrase());
+			$errorMessage = \Translator::swGettext("Got http error %s (%s) at url %s", $result, $response->getReasonPhrase(), $baseUrl ."/". $url);
 			return false;
 		}
Index: src/webservice/htdocs/SiWeather/Webservice/WebserviceConfig.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/WebserviceConfig.php	(revision db3869689166c7f2f4ad48f564ba1e317cc5e531)
+++ src/webservice/htdocs/SiWeather/Webservice/WebserviceConfig.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -24,5 +24,5 @@
 
 	function __construct(){
-		require(__DIR__ ."/../../config/config.php");
+		require(__DIR__ ."/../../../config/config.php");
 		$this->_config = $config;
 		$this->loadAdditionalConfiguration();
@@ -35,4 +35,14 @@
 	private function loadAdditionalConfiguration(){
 		$this->_config["dataDirectory"] = "data";
+		
+		require(__DIR__ ."/../../inc/internalconfig.php");
+		foreach(array_keys($internalconfig) as $key){
+			if(array_key_exists($key, $this->_config)){
+				error_log("Internal config entry ". $key ." already exists --> Keeping existing value and discard internal config value");
+			}
+			else{
+				$this->_config[$key] = $internalconfig[$key];
+			}
+		}
 	}
 
@@ -47,4 +57,8 @@
 			return $this->dataDirectory();
 		}
+		if($key == "webserviceBaseUrl"){
+// 			error_log("Use dataDirectory() function to access this value");
+			return $this->webserviceBaseUrl();
+		}
 		
 		return $this->_config[$key];
@@ -52,5 +66,13 @@
 
 	public function dataDirectory(){
-		return __DIR__ ."/../../". $this->_config["dataDirectory"];
+		return __DIR__ ."/../../../". $this->_config["dataDirectory"];
+	}
+	
+	public function webserviceBaseUrl(){
+		$baseUrl = $this->_config["webserviceBaseUrl"];
+		if(substr($baseUrl, strlen($baseUrl) - 1, 1) != "/"){
+			$baseUrl .= "/";
+		}
+		return $baseUrl;
 	}
 
Index: src/webservice/htdocs/inc/envsetup.php
===================================================================
--- src/webservice/htdocs/inc/envsetup.php	(revision db3869689166c7f2f4ad48f564ba1e317cc5e531)
+++ src/webservice/htdocs/inc/envsetup.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -20,5 +20,5 @@
 
 // set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ ."/../../vendor/");
-$composerAutoloader = require(__DIR__ ."/../../vendor/autoload.php");
+$composerAutoloader = require(__DIR__ ."/../../../vendor/autoload.php");
 if(is_object($composerAutoloader)){
 	$composerAutoloader->add("SiWeather\\Webservice\\", __DIR__ ."/../");
Index: src/webservice/htdocs/inc/footer.php
===================================================================
--- src/webservice/htdocs/inc/footer.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
+++ src/webservice/htdocs/inc/footer.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -0,0 +1,37 @@
+<?php
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+require_once(__DIR__ ."/envsetup.php");
+
+$webserviceConfig = new SiWeather\Webservice\WebserviceConfig();
+$apiVersion = $webserviceConfig->getConfig("webserviceApiVersion");
+
+echo "		<div class=\"footer\">\n";
+echo "			". Translator::swGettext("SiWeather webservice %s with API version %s), ", $webserviceConfig->getConfig("version"), $apiVersion) ."<br/>\n";
+echo "			". Translator::swGettext("Webservice accessible at %s or", $webserviceConfig->webserviceBaseUrl()) ."<br/>\n";
+echo "			". $webserviceConfig->webserviceBaseUrl() ."index.php/\n";
+echo "			<div class=\"footnotes\">\n";
+echo "				". _("This site uses icons from Oxygen icon theme &#40;License: LGPLv3,") ."<a href=\"http://www.kde.org/\">http://www.kde.org</a>&#41;\n";
+echo "			</div>\n";
+echo "		</div>\n";
+
+?>
+	</body>
+</html>
Index: src/webservice/htdocs/inc/header.php
===================================================================
--- src/webservice/htdocs/inc/header.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
+++ src/webservice/htdocs/inc/header.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -0,0 +1,37 @@
+<?php
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+require_once(__DIR__ ."/envsetup.php");
+
+if(!isset($title)){
+	$title = "";
+}
+
+?>
+
+<html>
+	<head>
+		<title><?php echo Translator::swGettext("SiWeather Webservice - %s", $title); ?></title>
+		<link rel="stylesheet" type="text/css" href="resources/css/webservice.css"/>
+	</head>
+	<body>
+		<div class="header">
+			<h1>SiWeather Webservice</h1>
+		</div>
Index: src/webservice/htdocs/index.php
===================================================================
--- src/webservice/htdocs/index.php	(revision db3869689166c7f2f4ad48f564ba1e317cc5e531)
+++ src/webservice/htdocs/index.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -46,14 +46,15 @@
 	array
 	(
-		"mode" => "production"
+		"mode" => $settings->getConfig("mode"),
 	)
 );
-$app->setName("siweather");
+$app->setName("SiWeather Webservice");
 
 // Only invoked if mode is "production"
 $app->configureMode('production', function () use ($app) {
     $app->config(array(
-        'log.enable' => true,
-        'debug' => false
+        "log.enable" => true,
+        "log.level" => \Slim\Log::WARN,
+        "debug" => false,
     ));
 });
@@ -61,18 +62,32 @@
 $app->configureMode('development', function () use ($app) {
     $app->config(array(
-        'log.enable' => false,
-        'debug' => true
+        "log.enable" => true,
+        "log.level" => \Slim\Log::DEBUG,
+        "debug" => true
     ));
 });
 
-// $app->notFound(function () use ($app) {
-//     $app->render(getConfig("webserviceBaseUrl")+ "404.html");
-// });
+$app->notFound(function () use ($app) {
+	$html = "";
+    if($app->config("debug")){
+        ob_start();
+        phpinfo( INFO_VARIABLES ^ INFO_ENVIRONMENT );
+        $html = ob_get_contents();
+        ob_end_clean();
+    }
+    $app->render("404.php", array("dump" => $html));
+});
 
-// $app->get("/stations", "stations");
+$app->get("/setup", function () use ($app){
+	$app->render("setup.php");
+});
+
 $app->get("/stations", "stations");
 $app->get("/stations/:uuid", function ($uuid){
 	echo "stations 123";
 });
+
+
+
 $app->run();
 
Index: src/webservice/htdocs/resources/css/webservice.css
===================================================================
--- src/webservice/htdocs/resources/css/webservice.css	(revision db3869689166c7f2f4ad48f564ba1e317cc5e531)
+++ src/webservice/htdocs/resources/css/webservice.css	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -1,4 +1,4 @@
 .success {
-	color: #45A545;
+	color: #66BD66;
 	font-weight: bold;
 }
@@ -7,4 +7,39 @@
 	color: #8C1C00;
 	font-weight: bold;
+}
+
+.lierror {
+	list-style-type: none;
+	background-image: url("../icons/dialog-cancel.png");
+	background-repeat: no-repeat;
+	background-position: left center;
+	background-size: auto 1em;
+	padding-left: 1.5em;
+}
+
+.lisuccess {
+	list-style-type: none;
+	background-image: url("../icons/dialog-ok-apply.png");
+	background-repeat: no-repeat;
+	background-position: left center;
+	background-size: auto 1em;
+	padding-left: 1.5em;
+}
+
+.header {
+	margin-top: 1em;
+	padding-top: 0.5em;
+	padding-left: 2em;
+	color: #ACDFAC;
+	text-align: left;
+	font-size: 9pt;
+	border-width: 0;
+	border-bottom-width: 2px;
+	border-color: #ACDFAC;
+	border-style: solid;
+}
+
+.header h1 {
+	font-size: 16pt;
 }
 
@@ -26,5 +61,12 @@
 }
 
-.footnotes a {
-	color: #ACDFAC;
+a {
+	color: #6BA3A3;
+	text-decoration: none;
+/* 	font-weight: bold; */
 }
+
+a:hover {
+	color: #6BA3A3;
+	text-decoration: underline;
+}
Index: src/webservice/htdocs/setup.php
===================================================================
--- src/webservice/htdocs/setup.php	(revision db3869689166c7f2f4ad48f564ba1e317cc5e531)
+++ src/webservice/htdocs/setup.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -19,115 +19,5 @@
 */
 
-require(__DIR__ ."/inc/envsetup.php");
-
-function printError($message)
-{
-	echo "<div class=\"error\">\n";
-	echo "	<h3>". _("The following error occured:") ."</h3>\n";
-	echo $message;
-	echo "</div>\n";
-}
-
-function printResult($result, $message)
-{
-	$class = "success";
-	$icon = "dialog-ok-apply.png";
-	if(!$result){
-		$class = "error";
-		$icon = "dialog-cancel.png";
-	}
-	echo "<li class=\"". $class ."\"><img src=\"resources/icons/". $icon ."\"/>". $message ."</li>\n";
-}
+require(__DIR__ ."/templates/setup.php");
 
 ?>
-
-<html>
-	<head>
-		<title><?php _("SiWeather Webservice Configuration"); ?></title>
-		<link rel="stylesheet" type="text/css" href="resources/css/webservice.css"/>
-	</head>
-	<body>
-		<h1><?php _("Welcome for the setup of the webservice backend for SiWeather"); ?></h1>
-		<ul>
-<?php
-
-$setup = new SiWeather\Webservice\Setup();
-
-$errorMessage = "";
-$result = $setup->dataDirectoryCheck($errorMessage);
-if($result == SiWeather\Webservice\DataDirectoryChecks::NotExist && $result != SiWeather\Webservice\DataDirectoryChecks::Success){
-	$result = $setup->dataDirectoryCreate($errorMessage);
-}
-
-if($result != SiWeather\Webservice\DataDirectoryChecks::Success){
-	printResult(false, myGettext("Data directory not accessible (%s)", $errorMessage));
-}
-else{
-	printResult(true, _("Data directory checked"));
-	$result = $setup->databaseDirectoryCheck($errorMessage);
-	if($result != SiWeather\Webservice\DatabaseChecks::Success){
-		printResult(false, $errorMessage);
-	}
-	else{
-		printResult(true, _("Database directory checked"));
-		$result = $setup->databaseFileCheck($errorMessage);
-		if($result != SiWeather\Webservice\DatabaseChecks::Success){
-			printResult(false, $errorMessage);
-		}
-		else{
-			printResult(true, _("Database file checked"));
-			if(!$setup->databaseConnection($errorMessage)){
-				printResult(false, $errorMessage);
-			}
-			else{
-				$prefix = "Database up and running";
-				$versionSqlite = $setup->databaseVersionSqlite($errorMessage);
-				if($versionSqlite <= 0){
-					printResult(false,  Translator::swGettext("%s (Could not determine SQLite version: %s)", $prefix, $errorMessage));
-				}
-				else{
-					$versionSpatalite = $setup->databaseVersionSpatalite($errorMessage);
-					if($versionSpatalite <= 0){
-						printResult(false, Translator::swGettext("%s (Could not determine Spatalite version: %s)", $prefix, $errorMessage));
-					}
-					else{
-						printResult(true, Translator::swGettext("%s (SQLite: %s, Spatalite: %s)", $prefix, $versionSqlite, $versionSpatalite));
-					}
-				}
-			}
-		}
-	}
-}
-
-$webserviceConfig = new SiWeather\Webservice\WebserviceConfig();
-if(!$setup->apiCheckWithoutRewrite($errorMessage)){
-	printResult(false, Translator::swGettext("Could not connect to webservice without rewrite (%s)", $errorMessage));
-}
-else{
-	$url = $webserviceConfig->getConfig("webserviceBaseUrl") ."/index.php/";
-	printResult(true, Translator::swGettext("Webservice withpout rewrite accessible at %s", "<a href=\"". $url ."\">". $url ."</a>"));
-}
-if(!$setup->apiCheckWithRewrite($errorMessage)){
-	printResult(false, Translator::swGettext("Could not connect to webservice with rewrite (%s)", $errorMessage));
-}
-else{
-	$url = $webserviceConfig->getConfig("webserviceBaseUrl") ."/". $webserviceConfig->getConfig("webserviceApiVersion");
-	printResult(true, Translator::swGettext("Webservice withp rewrite accessible at %s", "<a href=\"". $url ."\">". $url ."</a>"));
-}
-
-?>
-		</ul>
-<?php
-// 	$webserviceConfig = new SiWeather\Webservice\WebserviceConfig();
-	$apiVersion = $webserviceConfig->getConfig("webserviceApiVersion");
-	echo "		<div class=\"footer\">\n";
-	echo "			". Translator::swGettext("SiWeather webservice %s with API version %s), ", $webserviceConfig->getConfig("version"), $apiVersion) ."<br/>\n";
-	echo "			". Translator::swGettext("Webservice accessible at %s/%s/ or", $webserviceConfig->getConfig("webserviceBaseUrl"), $apiVersion) ."<br/>\n";
-	echo "			". $webserviceConfig->getConfig("webserviceBaseUrl") ."/index.php/\n";
-	echo "			<div class=\"footnotes\">\n";
-	echo "				". _("This site uses icons from Oxygen icon theme &#40;License: LGPLv3,") ."<a href=\"http://www.kde.org/\">http://www.kde.org</a>&#41;\n";
-	echo "			</div>\n";
-	echo "		</div>\n";
-?>
-	</body>
-</html>
Index: src/webservice/htdocs/templates/404.php
===================================================================
--- src/webservice/htdocs/templates/404.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
+++ src/webservice/htdocs/templates/404.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -0,0 +1,11 @@
+<html>
+	<head>
+		<title>SiWeather Webservice</title>
+	</head>
+	<body>
+		<h1>404 Site not found</h1>
+		<div class="dump">
+			<?php echo $dump; ?>
+		</div>
+	</body>
+</html>
Index: src/webservice/htdocs/templates/setup.php
===================================================================
--- src/webservice/htdocs/templates/setup.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
+++ src/webservice/htdocs/templates/setup.php	(revision 1e376487e79f3268499595a602e4c704176c054c)
@@ -0,0 +1,116 @@
+<?php
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+require(__DIR__ ."/../inc/envsetup.php");
+
+function printError($message)
+{
+	echo "<div class=\"error\">\n";
+	echo "	<h3>". _("The following error occured:") ."</h3>\n";
+	echo $message;
+	echo "</div>\n";
+}
+
+function printResult($result, $message)
+{
+	$class = "success";
+	if(!$result){
+		$class = "error";
+	}
+	echo "<li class=\"". $class ." li". $class ."\">". $message ."</li>\n";
+}
+
+$title = _("Setup");
+include(__DIR__ ."/../inc/header.php");
+?>
+
+		<h2><?php echo _("Welcome to the setup"); ?></h2>
+		<ul>
+<?php
+
+$setup = new SiWeather\Webservice\Setup();
+$webserviceConfig = new SiWeather\Webservice\WebserviceConfig();
+
+$errorMessage = "";
+$result = $setup->dataDirectoryCheck($errorMessage);
+if($result == SiWeather\Webservice\DataDirectoryChecks::NotExist && $result != SiWeather\Webservice\DataDirectoryChecks::Success){
+	$result = $setup->dataDirectoryCreate($errorMessage);
+}
+
+if($result != SiWeather\Webservice\DataDirectoryChecks::Success){
+	printResult(false, Translator::swGettext("Data directory not accessible (%s)", $errorMessage));
+}
+else{
+	printResult(true, Translator::swGettext("Data directory checked (%s)", realpath($webserviceConfig->getConfig("dataDirectory"))));
+	$result = $setup->databaseDirectoryCheck($errorMessage);
+	if($result != SiWeather\Webservice\DatabaseChecks::Success){
+		printResult(false, $errorMessage);
+	}
+	else{
+		printResult(true, _("Database directory checked"));
+		$result = $setup->databaseFileCheck($errorMessage);
+		if($result != SiWeather\Webservice\DatabaseChecks::Success){
+			printResult(false, $errorMessage);
+		}
+		else{
+			printResult(true, _("Database file checked"));
+			if(!$setup->databaseConnection($errorMessage)){
+				printResult(false, $errorMessage);
+			}
+			else{
+				$prefix = "Database up and running";
+				$versionSqlite = $setup->databaseVersionSqlite($errorMessage);
+				if($versionSqlite <= 0){
+					printResult(false,  Translator::swGettext("%s (Could not determine SQLite version: %s)", $prefix, $errorMessage));
+				}
+				else{
+					$versionSpatalite = $setup->databaseVersionSpatalite($errorMessage);
+					if($versionSpatalite <= 0){
+						printResult(false, Translator::swGettext("%s (Could not determine Spatalite version: %s)", $prefix, $errorMessage));
+					}
+					else{
+						printResult(true, Translator::swGettext("%s (SQLite: %s, Spatalite: %s)", $prefix, $versionSqlite, $versionSpatalite));
+					}
+				}
+			}
+		}
+	}
+}
+
+if(!$setup->apiCheckWithoutRewrite($errorMessage)){
+	printResult(false, Translator::swGettext("Could not connect to webservice without rewrite (%s)", $errorMessage));
+}
+else{
+	$url = $webserviceConfig->getConfig("webserviceBaseUrl") ."index.php/";
+	printResult(true, Translator::swGettext("Webservice withpout rewrite accessible at %s", "<a href=\"". $url ."\">". $url ."</a>"));
+}
+if(!$setup->apiCheckWithRewrite($errorMessage)){
+	printResult(false, Translator::swGettext("Could not connect to webservice with rewrite (%s)", $errorMessage));
+}
+else{
+	$url = $webserviceConfig->getConfig("webserviceBaseUrl");
+	printResult(true, Translator::swGettext("Webservice withp rewrite accessible at %s", "<a href=\"". $url ."\">". $url ."</a>"));
+}
+
+?>
+		</ul>
+<?php
+	include(__DIR__ ."/../inc/footer.php");
+?>
