'apiEndpoint' => env('GOOGLE_CLOUD_STORAGE_API_ENDPOINT', null), // set storageClient apiEndpoint 'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', null), // see: Public URLs below 'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', ''), // optional: /default/path/to/apply/in/bucket 'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', 'your-bucket'), 'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'), // optional: is included in key file 'key_file' =>, // optional: Array of data that substitutes the. 'key_file_path' => env('GOOGLE_CLOUD_KEY_FILE', base_path('service-account.json')), // optional: /path/to/service-account.json We need to add gcs to register it as another disk available to our laravel application //config/filesystems.php The file contains three different disk services, local, public and s3. Laravel handles storage disks through the config/filesystems.php file. composer require spatie/laravel-google-cloud-storage Update Filesystem file To interact with Google Cloud Storage APIs, we will use this package to do so. If you have no Laravel project created yet, you can create one using the laravel new command. Click save and your bucket is now ready to be used in Laravel. The Roles you should assign are Storage Admin, Storage Object Admin, Storage Object Creator, and Storage Object Viewer. You then need to assign cloud storage roles to your principal.Click on grant access and Add your Service Account as a Principal(search for it and it should pop up in the search).Click on your new bucket and head to the permissions tab. One final thing you need to do is to grant your service account access to your bucket and specify its roles.Once done click Create and your bucket is now ready. You can leave it as None since Google Cloud Storage Buckets are Secure by default. The last step is to choose the protection tools. Google Recommends Uniform Access Control but I was not able to wrap my head around how it works and thus I just use Fine-grained access control which allows me to authenticate through the service account I created earlier. When it comes to how your data will be accessed, there are two options Uniform and Fine-grained.For the default storage class, just choose the Standard class, or any other class depending on your needs.In this part, I will just choose a single region as it is the cheapest Name your bucket and choose the location where your bucket will be created.
0 Comments
Leave a Reply. |