-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#100 - Init projektu - pobieranie przykładowych zdjęć restauracji
Po załadowaniu restauracji korzystamy z faker to pobrania losowych zdjec dla restauracji. Pobrane zdjecia nastepnie wrzucamy na minio. Dzieki temu na naszej stronie glownej pojawia sie loga restauracji. Obecnie faker korzysta tylko z lorempixel, ktore nie dziala (fzaninotto/Faker#1884) Korzystamy wiec tymczasowo z forka, ktory dodaje usluge https://picsum.photos/
- Loading branch information
Showing
5 changed files
with
88 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace console\controllers; | ||
|
||
use Aws\S3\S3Client; | ||
use common\enums\BucketEnum; | ||
use yii\console\Controller; | ||
|
||
class InitController extends Controller | ||
{ | ||
public function actionCreateBucket(): void | ||
{ | ||
$bucket = 'ssorder'; | ||
/** @var S3Client $s3Client */ | ||
$s3Client = \Yii::$container->get(S3Client::class); | ||
$s3Client->createBucket(['Bucket' => $bucket]); | ||
|
||
$policyJson = <<<EOS | ||
{ | ||
"Version":"2012-10-17", | ||
"Statement":[ | ||
{ | ||
"Sid":"PublicRead", | ||
"Effect":"Allow", | ||
"Principal": "*", | ||
"Action":["s3:GetObject"], | ||
"Resource":["arn:aws:s3:::$bucket/*"] | ||
} | ||
] | ||
} | ||
EOS; | ||
|
||
$s3Client->putBucketPolicy([ | ||
'Bucket' => $bucket, | ||
'Policy' => $policyJson | ||
]); | ||
} | ||
} |