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

Accept SSL parameter as dict #64

Merged
merged 4 commits into from
Jun 5, 2023
Merged

Accept SSL parameter as dict #64

merged 4 commits into from
Jun 5, 2023

Conversation

iKlotho
Copy link
Contributor

@iKlotho iKlotho commented May 29, 2023

Most MySQL libraries support SSL configuration via a dictionary containing mysql_ssl_set params. This way users don't have to create SSL context by hand.

Available keys are key, cert, ca, capath, cipher, verify_mode and check_hostname

ssl_params = {
    "ca": "~/ca-cert.pem",
    "key": "~/client-key.pem",
    "cert": "~/client-cert.pem"
}
conn = await connect(ssl=ssl_params)

@long2ice
Copy link
Owner

long2ice commented Jun 1, 2023

This will break previous version, what about provide another param? changelog update is required also. Thanks!

@iKlotho
Copy link
Contributor Author

iKlotho commented Jun 1, 2023

The ssl param still accepts SSLContext and I don't think it will break previous versions. But If you think it's better I can use another parameter (maybe call it ssl_args) as you suggest.

def _create_ssl_ctx(self, sslp):
if isinstance(sslp, ssl.SSLContext):
return sslp

Also for the changelog should I add a new version called 0.2.9?

@long2ice
Copy link
Owner

long2ice commented Jun 1, 2023

OK, that's good. I missed it. And yes for 0.2.9

@long2ice long2ice merged commit d0791a1 into long2ice:dev Jun 5, 2023
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.

2 participants