Skip to content

Commit

Permalink
Change from "org" to "team" in serverless.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Oct 6, 2024
1 parent 6730fba commit ebbfd97
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
class Config
{
/**
* @return array{name: string, org: string, type: string}
* @return array{name: string, team: string, type: string}
* @throws Exception
*/
public static function loadConfig(): array
{
if (is_file('serverless.yml')) {
$serverlessConfig = self::readYamlFile('serverless.yml');
if (empty($serverlessConfig['service']) || str_contains((string) $serverlessConfig['service'], '$')) {
if (empty($serverlessConfig['service']) || ! is_string($serverlessConfig['service']) || str_contains($serverlessConfig['service'], '$')) {
throw new Exception('The "service" name in "serverless.yml" cannot contain variables, it is not supported by Bref Cloud');
}
$org = (string) ($serverlessConfig['custom']['brefOrg'] ?? '');
if (empty($org)) {
throw new Exception('To deploy a Serverless Framework project with Bref Cloud you must set the organization name in the "custom.brefOrg" field in "serverless.yml"');
$team = (string) ($serverlessConfig['bref']['team'] ?? $serverlessConfig['custom']['bref']['team'] ?? '');
if (empty($team)) {
throw new Exception('To deploy a Serverless Framework project with Bref Cloud you must set the team name in the "bref.team" field in "serverless.yml"');
}
if (str_contains($serverlessConfig['custom']['brefOrg'], '$')) {
if (str_contains($team, '$')) {
throw new Exception('The "service" name in "serverless.yml" cannot contain variables, it is not supported by Bref Cloud');
}
return [
'name' => (string) $serverlessConfig['service'],
'org' => $org,
'name' => $serverlessConfig['service'],
'team' => $team,
'type' => 'serverless-framework',
];
}
Expand Down

0 comments on commit ebbfd97

Please sign in to comment.