Update: 2026-06-23 15:35:14

This commit is contained in:
Hamza-Ayed
2026-06-23 15:35:14 +03:00
parent b4d054a870
commit bea94ed617
4 changed files with 69 additions and 6 deletions

View File

@@ -53,13 +53,19 @@ function loadEnvironment(string $filePath): void {
logMsg('✅ Environment loaded.');
}
loadEnvironment('/home/location/env/.env');
$siteUser = get_current_user();
$homeDir = "/home/$siteUser";
if (!is_dir($homeDir)) {
$homeDir = '/home/location'; // Fallback to original location
}
loadEnvironment(getenv('ENV_FILE_PATH') ?: ($homeDir . '/.env'));
// ============================================================
// 🔐 مفاتيح الأمان
// ============================================================
$INTERNAL_KEY = trim((string) @file_get_contents('/home/location/.internal_socket_key'));
$redisPass = trim((string) @file_get_contents('/home/location/.reds_pass_key'));
$INTERNAL_KEY = trim((string) @file_get_contents(getenv('INTERNAL_SOCKET_KEY_PATH') ?: ($homeDir . '/.internal_socket_key')));
$redisPass = trim((string) @file_get_contents(getenv('REDIS_PASS_KEY_PATH') ?: ($homeDir . '/.reds_pass_key')));
if (empty($INTERNAL_KEY)) logMsg('❌ CRITICAL: Internal key missing!');
if (empty($redisPass)) logMsg('❌ CRITICAL: Redis password missing!');