mirror of
https://github.com/grocy/grocy.git
synced 2025-08-29 09:16:31 +00:00
Added configuration validator class (#1215)
* Added configuration validator class * Review Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
11
app.php
11
app.php
@@ -12,6 +12,7 @@ require_once __DIR__ . '/vendor/autoload.php';
|
||||
// Load config files
|
||||
require_once GROCY_DATAPATH . '/config.php';
|
||||
require_once __DIR__ . '/config-dist.php'; // For not in own config defined values we use the default ones
|
||||
require_once __DIR__ . '/helpers/ConfigurationValidator.php';
|
||||
|
||||
// Definitions for dev/demo/prerelease mode
|
||||
if ((GROCY_MODE === 'dev' || GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease') && !defined('GROCY_USER_ID'))
|
||||
@@ -31,6 +32,16 @@ if (GROCY_DISABLE_AUTH === true)
|
||||
define('GROCY_SHOW_AUTH_VIEWS', false);
|
||||
}
|
||||
|
||||
// Check if any invalid entries in config.php have been made
|
||||
try
|
||||
{
|
||||
(new ConfigurationValidator())->validateConfig();
|
||||
}
|
||||
catch (EInvalidConfig $ex)
|
||||
{
|
||||
exit('Invalid setting in config.php: ' . $ex->getMessage());
|
||||
}
|
||||
|
||||
// Setup base application
|
||||
AppFactory::setContainer(new DI\Container());
|
||||
$app = AppFactory::create();
|
||||
|
Reference in New Issue
Block a user