load AWS regions and plans dynamically via SDK (#366)

This commit is contained in:
Saeed Vaziry
2024-11-17 00:01:53 +01:00
committed by GitHub
parent deb0b328e3
commit cc79aa9fbf
4 changed files with 121 additions and 30 deletions

View File

@ -79,6 +79,7 @@ public static function regions(?int $id): array
if (! $id) {
return [];
}
/** @var ?ServerProvider $profile */
$profile = self::find($id);
if (! $profile) {
return [];
@ -109,7 +110,7 @@ public static function plans(?int $id, ?string $region): array
}
$plans = $profile->provider()->plans($region);
Cache::put('plans-'.$id.'-'.$region, $plans, 600);
Cache::put('plans-'.$id.'-'.$region, $plans, 60);
return $plans;
}