forked from fa/breadcrumb-the-shire
config/config.php was gitignored and devs had to copy it from config/config.php.example on every fresh clone. Since the bootstrap config reads everything from .env via $envString() / $envInt() / $envBool() defaults, there is nothing developer-specific in the file — the cp step was dead ceremony. - Remove config/config.php from .gitignore and track it directly - Delete config/config.php.example - Drop the example-existence + per-doc reference checks from bin/docs-drift-check.sh; add a legacy-pattern check that flags any new mention of the removed example file - Update ConfigContractsTest to require config.php and forbid the example - Clean stale references in CLAUDE.md, README.md, six docs files, and the core-guardrails skill Same commit slims README down from 294 to 47 lines: one setup checklist (now 3 commands instead of 4), the seeded login table, the three quality-gate commands, and pointers to CLAUDE.md and docs/index.md for everything else. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
99 lines
3.2 KiB
PHP
99 lines
3.2 KiB
PHP
<?php
|
|
|
|
use MintyPHP\Auth;
|
|
use MintyPHP\App\Bootstrap\EnvValidator;
|
|
use MintyPHP\Cache;
|
|
use MintyPHP\DB;
|
|
use MintyPHP\Debugger;
|
|
use MintyPHP\Firewall;
|
|
use MintyPHP\I18n;
|
|
use MintyPHP\Router;
|
|
use MintyPHP\Session;
|
|
|
|
EnvValidator::validate();
|
|
|
|
$envString = static function (string $key, string $default): string {
|
|
$value = getenv($key);
|
|
if ($value === false || $value === '') {
|
|
return $default;
|
|
}
|
|
return (string) $value;
|
|
};
|
|
|
|
$envInt = static function (string $key, int $default): int {
|
|
$value = getenv($key);
|
|
if ($value === false || $value === '') {
|
|
return $default;
|
|
}
|
|
$parsed = filter_var($value, FILTER_VALIDATE_INT);
|
|
return $parsed !== false ? (int) $parsed : $default;
|
|
};
|
|
|
|
$envFloat = static function (string $key, float $default): float {
|
|
$value = getenv($key);
|
|
if ($value === false || $value === '') {
|
|
return $default;
|
|
}
|
|
$parsed = filter_var($value, FILTER_VALIDATE_FLOAT);
|
|
return $parsed !== false ? (float) $parsed : $default;
|
|
};
|
|
|
|
$envBool = static function (string $key, bool $default): bool {
|
|
$value = getenv($key);
|
|
if ($value === false || $value === '') {
|
|
return $default;
|
|
}
|
|
$parsed = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
|
return $parsed ?? $default;
|
|
};
|
|
|
|
$envList = static function (string $key, array $default): array {
|
|
$value = getenv($key);
|
|
if ($value === false || $value === '') {
|
|
return $default;
|
|
}
|
|
return array_values(array_filter(array_map('trim', explode(',', (string) $value))));
|
|
};
|
|
|
|
define('APP_NAME', $envString('APP_NAME', 'CoreCore'));
|
|
define('APP_TIMEZONE', $envString('APP_TIMEZONE', 'Europe/Berlin'));
|
|
define('APP_STORAGE_PATH', $envString('APP_STORAGE_PATH', __DIR__ . '/../storage'));
|
|
define('APP_CRYPTO_KEY', $envString('APP_CRYPTO_KEY', ''));
|
|
define('TENANT_SCOPE_STRICT', $envBool('TENANT_SCOPE_STRICT', true));
|
|
if (!defined('APP_LOCALES')) {
|
|
define('APP_LOCALES', $envList('APP_LOCALES', ['de', 'en']));
|
|
}
|
|
|
|
date_default_timezone_set(APP_TIMEZONE);
|
|
|
|
Router::$baseUrl = '/'; // default: '/'
|
|
Router::$pageRoot = 'pages/'; // default: 'pages/'
|
|
Router::$templateRoot = 'templates/'; // default: 'templates/'
|
|
|
|
Session::$sessionName = $envString('SESSION_NAME', 'MintyPHP');
|
|
|
|
Firewall::$concurrency = $envInt('FIREWALL_CONCURRENCY', 10);
|
|
Firewall::$spinLockSeconds = $envFloat('FIREWALL_SPINLOCK_SECONDS', 0.15);
|
|
Firewall::$intervalSeconds = $envInt('FIREWALL_INTERVAL_SECONDS', 300);
|
|
Firewall::$cachePrefix = $envString('FIREWALL_CACHE_PREFIX', 'fw_concurrency_');
|
|
Firewall::$reverseProxy = $envBool('FIREWALL_REVERSE_PROXY', false);
|
|
|
|
Cache::$servers = $envString('CACHE_SERVERS', '127.0.0.1');
|
|
|
|
DB::$host = $envString('DB_HOST', 'db');
|
|
DB::$username = $envString('DB_USER', 'mintyphp');
|
|
DB::$password = $envString('DB_PASS', 'mintyphp');
|
|
DB::$database = $envString('DB_NAME', 'mintyphp');
|
|
DB::$port = $envInt('DB_PORT', 3306);
|
|
|
|
Auth::$usersTable = 'users';
|
|
Auth::$usernameField = 'email';
|
|
Auth::$passwordField = 'password';
|
|
Auth::$createdField = 'created';
|
|
Auth::$totpSecretField = 'totp_secret';
|
|
|
|
Debugger::$enabled = $envBool('APP_DEBUG', true);
|
|
|
|
I18n::$domain = $envString('APP_I18N_DOMAIN', 'default');
|
|
I18n::$locale = $envString('APP_LOCALE', 'de');
|