Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow passing file contents as user_credentials, not just file paths #546

Merged
merged 1 commit into from
Mar 17, 2024
Merged

Allow passing file contents as user_credentials, not just file paths #546

merged 1 commit into from
Mar 17, 2024

Conversation

roguh
Copy link
Contributor

@roguh roguh commented Mar 15, 2024

Implemented with tempfile.NamedTemporaryFile, open to new ideas. We can potentially get rid of tempfile and use the contents directly without relying on open().

https://security.openstack.org/guidelines/dg_using-temporary-files-securely.html

Hi, from PowerFlex.

Implemented with tempfile.NamedTemporaryFile
@wallyqs
Copy link
Member

wallyqs commented Mar 16, 2024

Thanks for the PR, I was looking a how we could avoid the tempfile to support this usage. What do you think of something like this? e1c6924
This way usage would be:

await nats.connect(user_credentials=RawCredentials("<creds file contents as string>"))

@roguh
Copy link
Contributor Author

roguh commented Mar 16, 2024

That looks good. I would also prefer avoiding temp files, but wasn't sure how much of this code to change.

This also works well with type checkers and Python 3.7 I assume.

@wallyqs wallyqs merged commit bcd84d8 into nats-io:main Mar 17, 2024
1 check passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants