feat(EnvVar): Environment Variables Store#23710
Closed
markovejnovic wants to merge 1 commit into
Closed
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
env_var.zig- Environment Variable StoreThis PR adds a new mechanism to keep track of environment variables. Instead of loading them ad-hoc in various places, it uses a memoization strategy that loads the environment variable once, stores it in
.dataand then loads it as required.The goal of this PR is to make the tracking and management of environment variables (and feature flags) cleaner and safer
Misc
.deinit()operations not take aconst *Tbut now they all take*Ton @taylordotfish's requestuv_os_homedirfs.zig.Future Improvements
os.zigcould potentially benefit from being memoized. IsC:\Windowsreally going to change during the execution ofBun? Probably not -- so it is worthwhile to memoize those too.How did you verify your code works?
Hopefully regressions pass. This is a refactor and not much more.
Breaking Changes
BUN_CONFIG_DNS_TIME_TO_LIVE_SECONDShas been changed to no longer accept negative inputs. The legacy behavior would allow you to pass negative numbers which would cause it to meanstd.math.maxInt(32).