Initial commit with updated Auth and media ignored
This commit is contained in:
22
get_connect.php
Normal file
22
get_connect.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// ============================================================
|
||||
// get_connect.php
|
||||
// بديل con.php و jwtconnect.php للاتصالات الداخلية
|
||||
// ============================================================
|
||||
|
||||
require_once __DIR__ . '/core/bootstrap.php';
|
||||
|
||||
// 1. التحقق من مفتاح الحماية الداخلي (بديل الـ JWT للسيرفرات)
|
||||
JwtService::validateInternalKey();
|
||||
|
||||
// 2. Rate Limiting خفيف للطلبات الداخلية
|
||||
$limiter = new RateLimiter($redis);
|
||||
$limiter->enforce(RateLimiter::identifier(), 'api');
|
||||
|
||||
// 3. الاتصال الافتراضي بقاعدة البيانات (Lazy Load)
|
||||
try {
|
||||
$con = Database::get('main');
|
||||
} catch (Exception $e) {
|
||||
http_response_code(500);
|
||||
exit(json_encode(['error' => 'Database connection failed']));
|
||||
}
|
||||
Reference in New Issue
Block a user