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

Be able to safely load .env files #2920

Open
2 tasks done
C0D3-M4513R opened this issue Mar 13, 2025 · 0 comments
Open
2 tasks done

Be able to safely load .env files #2920

C0D3-M4513R opened this issue Mar 13, 2025 · 0 comments
Labels
request Request for new functionality

Comments

@C0D3-M4513R
Copy link

C0D3-M4513R commented Mar 13, 2025

What's missing?

Currently loading .env files is hard to do correctly.

Rocket REALLY WANTS you to execute it through the launch or main macro respectively.
Those macros setup an async runtime and run the async method body.

This is an issue, if we want to load .env files, since "loading a .env file" entails setting all key=value pairs to the processes environment. Setting a process environment is unsafe as of the 2024 edition (and realistically should be used as such in other editions too).

Ideal Solution

Either add a feature to load .env files to rocket, or allow users to execute before the async runtime starts
The first way could even be retro-fitted into current-releases of rocket.

Why can't this be implemented outside of Rocket?

Rockets REALLY WANTS to be controlling the async runtime startup.
If any other code is already in an async runtime, it's too late to be safely setting process environment variables.

Are there workarounds usable today?

  • Use a "custom" async runtime startup sequence
  • Just Hope and pray that everything will work regardless

Alternative Solutions

No response

Additional Context

No response

System Checks

  • I do not believe that this feature can or should be implemented outside of Rocket.
  • I was unable to find a previous request for this feature.
@C0D3-M4513R C0D3-M4513R added the request Request for new functionality label Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request Request for new functionality
Projects
None yet
Development

No branches or pull requests

1 participant