Update Saqel Platform: 2026-09-08 23:29:32

This commit is contained in:
Hamza-Ayed
2026-09-08 23:29:32 +03:00
parent 590326baa0
commit 90487a42ad
3 changed files with 57 additions and 24 deletions
+21 -15
View File
@@ -27,22 +27,28 @@ spl_autoload_register(function ($class) {
// 2. Load Environment Variables with Multi-Path Fallback
try {
$candidatePaths = [
'/home/intaleqapp-saqel/.env',
'/home/intaleqapp-saqel/htdocs/saqel.intaleqapp.com/.env',
'/home/intaleqapp-saqel/htdocs/saqel.intaleqapp.com/saqel/.env',
'/home/intaleqapp-saqel/htdocs/saqel.intaleqapp.com/saqel/backend/.env',
APP_ROOT . '/.env',
APP_ROOT . '/../.env'
];
// Production secrets belong outside the web/document root. Do not load
// backend/.env: it may be a placeholder and must never shadow the real
// CloudPanel environment file.
$envPath = getenv('SAQEL_ENV_FILE') ?: '/home/intaleqapp-saqel/.env';
$loaded = false;
foreach ($candidatePaths as $path) {
if (file_exists($path)) {
define('LOADED_ENV_PATH', $path);
\App\Core\Env::load($path);
$loaded = true;
break;
if (file_exists($envPath)) {
\App\Core\Env::load($envPath);
define('LOADED_ENV_PATH', $envPath);
$loaded = true;
// Support either GEMINI_API_KEYS=key1,key2 or the legacy singular
// variable containing a comma-separated pool. Legacy services receive
// one safe key; services with round-robin support consume the pool.
$geminiPool = trim((string)(getenv('GEMINI_API_KEYS') ?: getenv('GEMINI_API_KEY') ?: ''));
$geminiKeys = array_values(array_filter(array_map('trim', explode(',', $geminiPool))));
if (!empty($geminiKeys)) {
putenv('GEMINI_API_KEYS=' . implode(',', $geminiKeys));
$_ENV['GEMINI_API_KEYS'] = implode(',', $geminiKeys);
$_SERVER['GEMINI_API_KEYS'] = implode(',', $geminiKeys);
putenv('GEMINI_API_KEY=' . $geminiKeys[0]);
$_ENV['GEMINI_API_KEY'] = $geminiKeys[0];
$_SERVER['GEMINI_API_KEY'] = $geminiKeys[0];
}
}