commit melhorias compras4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-22 16:28:03 +02:00
parent efd97e265b
commit 36dcfdf00c
118 changed files with 6042 additions and 92 deletions
@@ -0,0 +1,36 @@
<?php
use Illuminate\Http\Request;
// Private loopback QA composition; no authentication bypass or public-path change in the product.
$settingsFile = getenv('SGC_DISTRIBUTION_QA_SETTINGS_FILE');
if (! is_string($settingsFile) || ! is_file($settingsFile)) {
http_response_code(503);
exit;
}
$settings = json_decode(file_get_contents($settingsFile), true, 32, JSON_THROW_ON_ERROR);
if (($settings['APP_ENV'] ?? '') !== 'testing' || ! preg_match('/^compras_receipts_test_[a-f0-9]{12}$/D', $settings['DB_DATABASE'] ?? '')
|| ($settings['DB_HOST'] ?? '') !== '127.0.0.1' || ($_SERVER['SERVER_PORT'] ?? '') != 8006) {
http_response_code(503);
exit;
}
foreach ($settings as $key => $value) {
putenv($key.'='.$value);
$_ENV[$key] = $_SERVER[$key] = $value;
}
$public = realpath($settings['SGC_DISTRIBUTION_QA_PUBLIC']);
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$file = realpath($public.'/'.ltrim(rawurldecode($path), '/'));
if ($file && str_starts_with(str_replace('\\', '/', $file), str_replace('\\', '/', $public).'/') && is_file($file)) {
$mime = ['js' => 'text/javascript', 'css' => 'text/css', 'svg' => 'image/svg+xml', 'png' => 'image/png', 'ico' => 'image/x-icon', 'woff' => 'font/woff', 'woff2' => 'font/woff2'];
$extension = pathinfo($file, PATHINFO_EXTENSION);
if (isset($mime[$extension])) {
header('Content-Type: '.$mime[$extension]);
readfile($file);
exit;
}
}
require __DIR__.'/../../vendor/autoload.php';
$app = require __DIR__.'/../../bootstrap/app.php';
$app->usePublicPath($public);
$app->handleRequest(Request::capture());