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

Reload .env file on change without restarting the application #28

Merged
merged 14 commits into from
Sep 11, 2024

Conversation

DeBuXer
Copy link
Contributor

@DeBuXer DeBuXer commented Aug 1, 2024

With this update, the application now automatically reloads environment variables from the .env file whenever changes are made. This eliminates the need to restart the application when updating an environment variable.

@willnode
Copy link
Owner

willnode commented Aug 3, 2024

This is good and I can think some actual use case, but you need to clear all variables from util.js to invalidate all config that read from envar. You can create a function in util.js to clear these.

Copy link
Owner

@willnode willnode left a comment

Choose a reason for hiding this comment

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

Please add a function to invalidate all config in util.js

Copy link
Owner

@willnode willnode left a comment

Choose a reason for hiding this comment

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

Please add a function to invalidate all config in util.js

@DeBuXer
Copy link
Contributor Author

DeBuXer commented Aug 6, 2024

I have added a clearConfig() function, but I'm not 100% sure if this is what you meant. If this isn't what you had in mind, could you please clarify what you mean exactly?

Thanks!

@willnode
Copy link
Owner

willnode commented Aug 8, 2024

This is correct. Because all reads from process.env are cached. Because it's set null all variables will be forced to be reset again in each util function.

@willnode
Copy link
Owner

willnode commented Aug 8, 2024

Can you try solve merge conflict before I approve this?

@DeBuXer
Copy link
Contributor Author

DeBuXer commented Aug 9, 2024

Absolutely! I'm just going to wait to resolve the merge conflict until MR29 is merged as well. Otherwise, I'll end up with another merge conflict there later :)

@DeBuXer
Copy link
Contributor Author

DeBuXer commented Aug 12, 2024

I think the branch is up-to-date now, all merge conflicts are solved.

@willnode willnode merged commit 5f85cc7 into willnode:main Sep 11, 2024
3 checks passed
@DeBuXer DeBuXer deleted the reload_env branch September 16, 2024 11:12
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