can install if input Region in env

pull/98/head
qkqpttgf 2020-03-03 09:58:52 +08:00 committed by GitHub
parent 6fa56b7525
commit fcaa61b8e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -35,8 +35,11 @@ function GetPathSetting($event, $context)
$serviceId = $event['requestContext']['serviceId']; $serviceId = $event['requestContext']['serviceId'];
if ( $serviceId === substr($host_name,0,strlen($serviceId)) ) { if ( $serviceId === substr($host_name,0,strlen($serviceId)) ) {
$_SERVER['base_path'] = '/'.$event['requestContext']['stage'].'/'.$_SERVER['function_name'].'/'; $_SERVER['base_path'] = '/'.$event['requestContext']['stage'].'/'.$_SERVER['function_name'].'/';
$_SERVER['Region'] = substr($host_name, strpos($host_name, '.')+1); $_SERVER['Region'] = getenv('Region');
$_SERVER['Region'] = substr($_SERVER['Region'], 0, strpos($_SERVER['Region'], '.')); if ($_SERVER['Region'] == '') {
$_SERVER['Region'] = substr($host_name, strpos($host_name, '.')+1);
$_SERVER['Region'] = substr($_SERVER['Region'], 0, strpos($_SERVER['Region'], '.'));
}
$path = substr($event['path'], strlen('/'.$_SERVER['function_name'].'/')); $path = substr($event['path'], strlen('/'.$_SERVER['function_name'].'/'));
} else { } else {
$_SERVER['base_path'] = $event['requestContext']['path']; $_SERVER['base_path'] = $event['requestContext']['path'];