Skip to content

Conversation

@mantmorre
Copy link

Will eventually close #117

Adds support for async-std along with the new load macro for dotenvy. Also includes an example with tokio and the new macro.

(Apologies for creating a second PR. I did not properly name my branch before opening the previous one.)

@mantmorre
Copy link
Author

@allan2 While the process might be convoluted, is there anything inherently wrong with the changes I made?
If dotenvy is the first thing to be run, and it doesn't use any asynchronous calls, what is the requirement to have it be in a synchronous function?

@allan2
Copy link
Owner

allan2 commented Sep 5, 2024

Please read the std::env::set_var safety notice.

This makes it not practically possible for you to guarantee that no other thread will read the environment, so the only safe option is to not use set_var or remove_var in multi-threaded programs at all.

Two comments:

  • #[load] should be on top of #[async_std::main]
  • no need to have the expansion output in the repo
  • just an example parallel to the tokio example will suffice

@mantmorre mantmorre force-pushed the async-std-integration branch from 2396aa9 to 2eb0f65 Compare September 6, 2024 03:04
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