2026-02-04 23:31:53 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use MintyPHP\Auth;
|
|
|
|
|
use MintyPHP\Cache;
|
|
|
|
|
use MintyPHP\DB;
|
|
|
|
|
use MintyPHP\Debugger;
|
|
|
|
|
use MintyPHP\Firewall;
|
|
|
|
|
use MintyPHP\I18n;
|
|
|
|
|
use MintyPHP\Router;
|
|
|
|
|
use MintyPHP\Session;
|
|
|
|
|
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
$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', 'IMVS'));
|
|
|
|
|
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));
|
2026-02-04 23:31:53 +01:00
|
|
|
if (!defined('APP_LOCALES')) {
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
define('APP_LOCALES', $envList('APP_LOCALES', ['de', 'en']));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!defined('APP_ROUTE_DEFINITIONS')) {
|
|
|
|
|
$routesFile = __DIR__ . '/routes.php';
|
|
|
|
|
$routeDefinitions = is_file($routesFile) ? include $routesFile : [];
|
|
|
|
|
if (!is_array($routeDefinitions)) {
|
|
|
|
|
$routeDefinitions = [];
|
|
|
|
|
}
|
|
|
|
|
define('APP_ROUTE_DEFINITIONS', $routeDefinitions);
|
2026-02-04 23:31:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!defined('APP_PUBLIC_PATHS')) {
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
$publicPaths = [];
|
|
|
|
|
foreach (APP_ROUTE_DEFINITIONS as $route) {
|
|
|
|
|
if (!empty($route['public'])) {
|
|
|
|
|
$path = trim((string) ($route['path'] ?? ''));
|
|
|
|
|
if ($path !== '') {
|
|
|
|
|
$publicPaths[] = $path;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!$publicPaths) {
|
|
|
|
|
throw new RuntimeException('No public routes configured in config/routes.php');
|
|
|
|
|
}
|
|
|
|
|
define('APP_PUBLIC_PATHS', array_values(array_unique($publicPaths)));
|
2026-02-04 23:31:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
date_default_timezone_set(APP_TIMEZONE);
|
|
|
|
|
|
|
|
|
|
Router::$baseUrl = '/'; // default: '/'
|
|
|
|
|
Router::$pageRoot = 'pages/'; // default: 'pages/'
|
|
|
|
|
Router::$templateRoot = 'templates/'; // default: 'templates/'
|
|
|
|
|
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
Session::$sessionName = $envString('SESSION_NAME', 'MintyPHP');
|
2026-02-04 23:31:53 +01:00
|
|
|
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
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);
|
2026-02-04 23:31:53 +01:00
|
|
|
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
Cache::$servers = $envString('CACHE_SERVERS', '127.0.0.1');
|
2026-02-04 23:31:53 +01:00
|
|
|
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
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);
|
2026-02-04 23:31:53 +01:00
|
|
|
|
|
|
|
|
Auth::$usersTable = 'users';
|
|
|
|
|
Auth::$usernameField = 'email';
|
|
|
|
|
Auth::$passwordField = 'password';
|
|
|
|
|
Auth::$createdField = 'created';
|
|
|
|
|
Auth::$totpSecretField = 'totp_secret';
|
|
|
|
|
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
Debugger::$enabled = $envBool('APP_DEBUG', true);
|
2026-02-04 23:31:53 +01:00
|
|
|
|
add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks
- Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists
- Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services
- Add Microsoft OIDC SSO, API token management, and user lifecycle features
- Add swagger-ui vendor integration and OpenAPI spec
- Add production Docker setup and bin/ scripts
- Update composer dependencies, config, templates, and frontend assets throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:27:35 +01:00
|
|
|
I18n::$domain = $envString('APP_I18N_DOMAIN', 'default');
|
|
|
|
|
I18n::$locale = $envString('APP_LOCALE', 'de');
|