Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly mention AWS region #653

Merged
1 commit merged into from Oct 10, 2019
Merged

Explicitly mention AWS region #653

1 commit merged into from Oct 10, 2019

Conversation

thePanz
Copy link
Contributor

@thePanz thePanz commented Oct 7, 2019

Q A
License MIT
Doc issue/PR symfony/symfony#33827

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request passes validation.

@stof
Copy link
Member

stof commented Oct 7, 2019

@fabpot @Nyholm should we actually build this recipe with separate env variables for the different parts of the DSN, and then combining it in a URL DSN through interpolation ? This is the best way to cause confusion regarding the necessary escaping (as the interpolation cannot apply URL escaping at the time of using the non-URL env variable)

@fabpot
Copy link
Member

fabpot commented Oct 7, 2019

@stof This has been changed in 4.4. Which means that you (@thePanz) should probably do the same change in the related file in the 4.4 directory.

@thePanz
Copy link
Contributor Author

thePanz commented Oct 7, 2019

@fabpot I am unsure about the 4.4 changes, there the @default is used, should it be replaced with @default?region=eu-west-1?
I will need to have a look at the code first, to find out how the @default is handled

@stof
Copy link
Member

stof commented Oct 7, 2019

@thePanz default is the host in the DSN to tell the transport to use its default host (which depends on the region too). We cannot omit the host in a URL.

@thePanz
Copy link
Contributor Author

thePanz commented Oct 7, 2019

@stof : that's clear. I just wanted to check how the region should be passed to the Factory via the DNS. I found my answer here: https://github.com/symfony/amazon-mailer/blob/4.4/Transport/SesTransportFactory.php#L29

Btw I agree to not use a AWS_SES_REGION variable. I will change my PR soon

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request passes validation.

@vittominacori
Copy link

@thePanz I think that other than requiring it in recipe it should not be set as default null in Transport constructor otherwise users can continue ignore it.
Yes, obviously, it keep back compatibility and everything working but it make sense to keep $this->region = $region ?: 'eu-west-1'; in a constructor having value set as null by default like here?

@fabianoroberto
Copy link

@stof : that's clear. I just wanted to check how the region should be passed to the Factory via the DNS. I found my answer here: https://github.com/symfony/amazon-mailer/blob/4.4/Transport/SesTransportFactory.php#L29

Btw I agree to not use a AWS_SES_REGION variable. I will change my PR soon

Why is it better not to use AWS_SES_REGION variable?

IMHO I think is better have an explicit variable empty or with a default value like this:

"env": {
         "#1": "AWS_ACCESS_KEY=",
         "#2": "AWS_SECRET_KEY=",
         "#3": "AWS_SES_REGION="
         "#4": "MAILER_DSN=smtp://$AWS_ACCESS_KEY:$AWS_SECRET_KEY@ses?region=$AWS_SES_REGION",
         "#5": "MAILER_DSN=http://$AWS_ACCESS_KEY:$AWS_SECRET_KEY@ses?region=$AWS_SES_REGION"
     }

So in sample above if AWS_SES_REGION is empty default value will be eu-west-1 ($this->region = $region ?: 'eu-west-1';)

@stof
Copy link
Member

stof commented Oct 10, 2019

@fabianoroberto using other variables interpolated in a URL is a bad idea, because the interpolation will not apply any escaping (it cannot) and so the separate variables will need to contain URL-escaped value (in which case they become unusable on their own).
That's why the AWS_ACCESS_KEY and AWS_SECRET_KEY have been removed in the new version of the recipe.

Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge now

ghost pushed a commit that referenced this pull request Oct 10, 2019
@ghost ghost merged commit bd1abcd into symfony:master Oct 10, 2019
@thePanz thePanz deleted the patch-1 branch October 10, 2019 15:32
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants