Skip to content

Commit

Permalink
Merge pull request #1038 from brefphp/revert-1020-patch-2
Browse files Browse the repository at this point in the history
Revert "Understand file include notation"
  • Loading branch information
deleugpn authored Sep 22, 2021
2 parents a1d1e5e + 55c39c8 commit ed9fad1
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/Console/Command/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,6 @@ private function handlerFromServerlessYml(string $function, ?string $config): st

$serverlessConfig = Yaml::parseFile($file, Yaml::PARSE_CUSTOM_TAGS);

/**
* Verify and parse functions using `file()` notation:
*
* functions:
* - ${file(serverless/functions/web.yml)}
* - ${file(serverless/functions/artisan.yml)}
*/
if (isset($serverlessConfig['functions'])) {
foreach ($serverlessConfig['functions'] as $key => $fileInclude) {
preg_match('/\$\{file\((.*?)\)\}/', $fileInclude, $matches);

if (is_int($key) && ! empty($matches[1])) {
$parsedFunction = Yaml::parseFile($matches[1], Yaml::PARSE_CUSTOM_TAGS);

if (isset($parsedFunction[$function])) {
$serverlessConfig['functions'][$function] = $parsedFunction[$function];
}
}
}
}

if (! isset($serverlessConfig['functions'][$function])) {
throw new Exception("There is no function named '$function' in serverless.yml");
}
Expand Down

0 comments on commit ed9fad1

Please sign in to comment.