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

Feature/decouple env vars #105

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Philipp-Binder
Copy link
Contributor

@Philipp-Binder Philipp-Binder commented Sep 21, 2024

Solves #92

Decoupling the concerns of Parsers and Env leads to a more consistent behaviour with different LoadOptions.
Namely it solves the different behaviour of Interpolation, when setting SetEnvVars to true or false.

While the parsers main responsibility now is correct parsing and returning the values from the EnvFile, the Env-class takes the responsibility about setting EnvVars, preventing clobber and so on.

With a next step it would be additionally possible to add a LoadOptions-Parameter to be able to ignore (System-)Environment variables at all, which could be a good thing if you work on a system which is polluted with EnvVars by default, and you don't want to see any side effects from your systems EnvVars.

@Philipp-Binder Philipp-Binder marked this pull request as draft September 22, 2024 09:50
@Philipp-Binder
Copy link
Contributor Author

Just realized some things which are not covered by tests.
I need to check that first and come back with some new tests showing these cases.

--> converted to draft

@Philipp-Binder
Copy link
Contributor Author

I've reworked the whole draft, putting test-cases to the start of the PR.

But right now I will postpone the work here until the migration to superpower in #106 is completed.

@rogusdev
Copy link
Collaborator

rogusdev commented Oct 9, 2024

I like the look of this! Please update for the superpower merge, and I'll go over more granularly. But I very much like where this is headed.

@Philipp-Binder
Copy link
Contributor Author

Philipp-Binder commented Oct 9, 2024

Updating to superpower-stuff was kinda easy, but still I need to invest some time and comment some cases.
E.g. there are breaking changes to be discussed, I tried to have none, but that was not possible in the end.

I will come back here soon.

Shows additional testingIssues due to coupling to EnvironmentVariables (ParseInterpolatedNoEnvVarsTest, ParseInterpolatedTest)
…ess to EnvironmentVariables inside IValue;

makes ParseInterploatedNoEnvVarsTest and ParseInterpolatedTest green again
breaks many other tests at this stage, because IValue does not check EnvironmentVariables now
…able dependencies in the tests where it is possible (check values differently, to be independent from EnvironmentVariables)

makes test AddSourceToBuilderAndLoadMultiWithClobber red, because EnvVarSnapshot gets a reset for each load-process (new multi-file-load problem)
…epending results with "not to be clobbered" EnvVars in Env.LoadContents

makes LoadMultiTestNoEnvVars green
…nvFile by solving the EnvVarSet-Logic completely into Env.LoadContents
…ibility for "NoClobber", but if one needs raw values Parsers.ParseDotEnvFile has to be used directly
…aking it just an implementationDetail for LoadMulti
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