aws/aws-sdk-php-laravel

Change the default region env variable to be consistent with the Laravel env example file

peppermintology opened this issue · 4 comments

Describe the feature

Since v5.8 Laravel has provided example .env variables for configuring AWS settings, one of which is the AWS_DEFAULT_REGION key for configuring the default region (https://github.com/laravel/laravel/blob/5.8/.env.example). This package sets us-east-1 as the default region unless you define an alternative using the AWS_REGION key in your .env.

Suggest changing the environment key to use the same key that is already defined in the Laravel .env.example so that an effectively duplicate key does not need to be added. This also keeps it consistent with the other keys Laravel and the package share.

Use Case

No duplication of keys/values and keeps things consistent.

Proposed Solution

Update both config/aws_default.php and config/aws_publish.php to:

Replace

'region' => env('AWS_REGION', 'us-east-1'),

With

'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

3.7

Environment details (OS name and version, etc.)

Fedora 36

Hi there,

The AWS SDKs only support AWS_REGION env variable. AFAIK only the AWS CLI supports AWS_DEFAULT_REGION and at this point in time there is no plan to support this additional env variable in the AWS SDKs.

Can you describe how this is blocking you from using AWS_REGION? Does Laravel not have a fallback to this env variable? I don't have context about why this env variable was introduced in 5.8, It might have been an oversight on their part.

I suggest raising this issue in the Laravel repo to get a little more clarity on the matter.

Thanks,
Ran~

New versions of Laravel can not recognise the .env key AWS_REGION, it was replaced by AWS_DEFAULT_REGION. Older versions of Laravel do not have this issue. That’s why I put the condition, if it is older then get the region from the AWS_REGION, if newer then use AWS_DEFAULT_REGION

Hi @bashar94 ,

I understand the context for your PR, but the change from AWS_REGION to AWS_DEFAULT_REGION on Laravel's side was an oversight, therefore we are not going to support the latter env variable.

Is there anything preventing you / users of Laravel to override the config with the appropriate env variable? From looking at the usage of this env variable on their project, all I see is this is functioning as a default value that should be configurable.

I think it would be worth cutting Laravel a PR to revert that env variable back to the original supported one.

Thanks,
Ran~

This issue has not recieved a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.