Update driver and rider socket URLs to jordan-siro.intaleqapp.com for Docker setup

This commit is contained in:
Hamza-Ayed
2026-07-22 04:15:18 +03:00
parent 6282be37d8
commit 901f429b9c
3 changed files with 36 additions and 10 deletions
+33 -7
View File
@@ -55,7 +55,17 @@ function loadEnvironment(string $filePath): void {
logMsg('✅ Environment loaded.');
}
loadEnvironment('/home/location/env/.env');
// Try Docker .env first, then legacy path
$envPaths = [
__DIR__ . '/../docker/.env',
'/home/location/env/.env',
];
foreach ($envPaths as $envPath) {
if (file_exists($envPath)) {
loadEnvironment($envPath);
break;
}
}
// ============================================================
// 🔐 مفاتيح الأمان
@@ -77,10 +87,22 @@ function getJwtSecret(): string {
}
return getenv('JWT_SECRET_KEY') ?: '';
}
$redisPass = trim((string) @file_get_contents('/home/location/.reds_pass_key'));
// Redis password: try env var, then Docker keys, then legacy path, then null (Docker Redis has no password)
$redisPass = null;
$redisPassPaths = [
getenv('REDIS_PASS_KEY_PATH') ?: '',
'/keys/.reds_pass_key',
'/home/location/.reds_pass_key',
];
foreach ($redisPassPaths as $rpp) {
if (!empty($rpp) && file_exists($rpp)) {
$redisPass = trim((string) @file_get_contents($rpp));
break;
}
}
if (empty($INTERNAL_KEY)) logMsg('❌ CRITICAL: Internal key missing!');
if (empty($redisPass)) logMsg('❌ CRITICAL: Redis password missing!');
if (empty($INTERNAL_KEY)) logMsg('⚠️ Internal key not found (non-critical in Docker)');
if (empty($redisPass)) logMsg('ℹ️ Redis password not set (OK for Docker — no auth required)');
// ============================================================
// 🗄️ Redis Singleton
@@ -102,13 +124,17 @@ function getRedis(): ?RedisClient {
try {
$redisHost = getenv('REDIS_HOST') ?: ($_ENV['REDIS_HOST'] ?? (file_exists('/.dockerenv') ? 'redis' : '127.0.0.1'));
$client = new RedisClient([
$config = [
'scheme' => 'tcp',
'host' => $redisHost,
'port' => (int)(getenv('REDIS_PORT') ?: 6379),
'password' => $redisPass,
'read_write_timeout' => 0,
]);
];
// Only include password if it's actually set (Docker Redis has no password)
if (!empty($redisPass)) {
$config['password'] = $redisPass;
}
$client = new RedisClient($config);
$client->connect();
$redis = $client;
return $redis;