Prepare for embedded mode

This commit is contained in:
Bernd Bestel
2018-07-16 21:17:32 +02:00
parent db9ee93d2b
commit 3b4141eb4d
11 changed files with 36 additions and 15 deletions

13
app.php
View File

@@ -6,8 +6,17 @@ use \Psr\Http\Message\ResponseInterface as Response;
use \Grocy\Helpers\UrlManager;
use \Grocy\Controllers\LoginController;
if (file_exists(__DIR__ . '/embedded.txt'))
{
define('DATAPATH', file_get_contents(__DIR__ . '/embedded.txt'));
}
else
{
define('DATAPATH', __DIR__ . '/data');
}
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/data/config.php';
require_once DATAPATH . '/config.php';
require_once __DIR__ . '/config-dist.php'; //For not in own config defined values we use the default ones
// Setup base application
@@ -18,7 +27,7 @@ $appContainer = new \Slim\Container([
],
'view' => function($container)
{
return new \Slim\Views\Blade(__DIR__ . '/views', __DIR__ . '/data/viewcache');
return new \Slim\Views\Blade(__DIR__ . '/views', DATAPATH . '/viewcache');
},
'LoginControllerInstance' => function($container)
{