@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
/** One versioned optional host schema, used only by guarded disposable QA fixtures. */
|
||||
function budgetDistributionFixtureSchema(): void
|
||||
{
|
||||
$migration = require __DIR__.'/../../database/qa-migrations/2026_11_22_000004_create_budget_distributions.php';
|
||||
$migration->up();
|
||||
}
|
||||
@@ -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());
|
||||
Reference in New Issue
Block a user