76 lines
2.9 KiB
PHP
76 lines
2.9 KiB
PHP
<?php
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Open DMARC Analyzer - Open Source DMARC Analyzer
|
|
Copyright (C) 2023 - John Bradley (userjack6880)
|
|
|
|
config.php
|
|
configuration file
|
|
|
|
Available at: https://github.com/userjack6880/Open-DMARC-Analyzer
|
|
-------------------------------------------------------------------------------
|
|
|
|
This file is part of Open DMARC Analyzer, modified by ZeGuigui for docker image
|
|
|
|
Open DMARC Analyzer is free software: you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
version.
|
|
|
|
This program 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 General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
this program. If not, see <https://www.gnu.org/licenses/>.
|
|
---------------------------------------------------------------------------- */
|
|
|
|
// Database Settings
|
|
define('DB_HOST', getEnvOrDefault('DB_HOST','localhost'));
|
|
define('DB_USER', getEnvOrDefault('DB_USER','dmarc'));
|
|
define('DB_PASS', getEnvOrDefault('DB_PASS','password'));
|
|
define('DB_NAME', getEnvOrDefault('DB_NAME','dmarc'));
|
|
define('DB_PORT', getEnvOrDefault('DB_PORT','3306')); // default port 3306, 5432 for pgsql
|
|
define('DB_TYPE', getEnvOrDefault('DB_TYPE','mysql')); // supported mysql and pgsql
|
|
|
|
// Debug Settings
|
|
define('DEBUG', getEnvOrDefault('DEBUG','1', true));
|
|
|
|
// Template Settings
|
|
define('TEMPLATE', getEnvOrDefault('TEMPLATE','openda'));
|
|
|
|
// Package Loader
|
|
define('AUTO_LOADER', getEnvOrDefault('AUTO_LOADER', 'vendor/autoload.php')); // autoloader for composer installed libraries
|
|
|
|
// GeoIP2 Settings
|
|
define('GEO_ENABLE', getEnvOrDefault('GEO_ENABLE','1',true)); // 0 - disable GeoIP2, 1 - enable GeoIP2
|
|
define('GEO_DB', getEnvOrDefault('GEO_DB','includes/geolite2.mmdb')); // location of GeoIP2 database
|
|
|
|
// Date Range
|
|
define('DATE_RANGE', getEnvOrDefault('DATE_RANGE', '-1w'));
|
|
|
|
// Get value from environment or use default value if not provided
|
|
// will also test _FILE to get secrets if needed!
|
|
function getEnvOrDefault($envName, $defaultValue, $isInt = false) {
|
|
$value = getenv($envName . "_FILE");
|
|
|
|
if ($value !== false) {
|
|
// Get value from file!
|
|
$value = file_get_contents($value);
|
|
} else {
|
|
$value = getenv($envName);
|
|
}
|
|
|
|
// Still no value from environment or error while reading file?
|
|
if ($value === false) {
|
|
$value = $defaultValue;
|
|
}
|
|
|
|
if ($isInt) {
|
|
$value = intval($value, 10);
|
|
}
|
|
|
|
return $value;
|
|
}
|
|
|
|
?>
|