10 lines
853 B
PHP
10 lines
853 B
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;
|
|
require $public.'/index.php';
|