17 lines
1.2 KiB
PHP
17 lines
1.2 KiB
PHP
<?php
|
|
$path=getenv('PAYABLE_SETTINGS_FILE')?:'';
|
|
if(!preg_match('~^C:/laragon/data/sgf-tempo/secrets/payables-(demo|proof)-(compras|sgf)\.json$~D',$path)){http_response_code(503);exit('Isolated host configuration required.');}
|
|
$s=json_decode(file_get_contents($path),true,32,JSON_THROW_ON_ERROR);
|
|
if(!preg_match('/^(compras_receipts_test_|payable_sgf_)[a-f0-9]{12}$/D',$s['DB_DATABASE'])||$s['DB_HOST']!=='127.0.0.1'||$s['APP_ENV']!=='payable-testing'){http_response_code(503);exit('Invalid test host.');}
|
|
foreach($s as $k=>$v){putenv($k.'='.$v);$_ENV[$k]=$_SERVER[$k]=$v;}
|
|
$public=realpath($s['HOST_ROOT'].'/public');$uri=rawurldecode(parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH)?:'/');$file=realpath($public.$uri);
|
|
if($uri!=='/'&&$file&&str_starts_with($file,$public.DIRECTORY_SEPARATOR)&&is_file($file))return false;
|
|
// Password-free entry belongs only to this isolated demonstration host.
|
|
define('LARAVEL_START', microtime(true));
|
|
require $s['HOST_ROOT'].'/vendor/autoload.php';
|
|
$app = require $s['HOST_ROOT'].'/bootstrap/app.php';
|
|
$app->booted(function () use ($s) {
|
|
require __DIR__.'/payables-demo-entry.php';
|
|
});
|
|
$app->handleRequest(\Illuminate\Http\Request::capture());
|