-
Notifications
You must be signed in to change notification settings - Fork 50
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
base: master
Are you sure you want to change the base?
Feature/decouple env vars #105
Conversation
Just realized some things which are not covered by tests. --> converted to draft |
385ecc9
to
939a237
Compare
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. |
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. |
939a237
to
f896bea
Compare
Updating to superpower-stuff was kinda easy, but still I need to invest some time and comment some cases. I will come back here soon. |
Shows additional testingIssues due to coupling to EnvironmentVariables (ParseInterpolatedNoEnvVarsTest, ParseInterpolatedTest)
…on when having NoClobber and NoEnvVars
…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)
…arsers to EnvironmentVariables)
…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
…m Env inside Parsers;
f896bea
to
dd61524
Compare
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.