web-utils/load_config.php

23 lines
597 B
PHP
Raw Permalink Normal View History

2021-08-08 17:23:49 +00:00
<?php
2021-08-08 17:32:01 +00:00
if (!file_exists('./config.php')) {
die('Config file not present');
}
2021-08-08 17:23:49 +00:00
$config = require('./config.php');
2021-08-08 17:32:01 +00:00
if (!is_array($config)) {
die('Config must be an array');
}
2021-08-08 17:23:49 +00:00
// a basic validation of config keys
if (!(isset($config['domain']) && strlen($config['domain']) > 0)) {
die('Domain key not present in config');
}
if (!(isset($config['modules']) && count($config['modules']) > 0)) {
die('Modules key not present in config or no modules configured');
}
if (!(isset($config['auth']) && count($config['auth']) > 0)) {
die('Auth key not present in config or no auth configured');
}