tonerdo / dotnet-env

A .NET library to load environment variables from .env files
MIT License
427 stars 50 forks source link

Missing option for custom EnvironmentVariableTarget. #26

Closed mokeyish closed 4 years ago

mokeyish commented 5 years ago

Missing option for custom EnvironmentVariableTarget.

https://github.com/tonerdo/dotnet-env/blob/038186f9a927439c6bdd735918e2b7fe79c37671/src/DotNetEnv/LoadVars.cs#L11

rogusdev commented 5 years ago

I don't know what you mean. Please explain what you are trying to accomplish.

chestercodes commented 5 years ago

I think that the idea is something like this - https://github.com/chestercodes/dotnet-env/commit/d8a29b6eb2359c68cd37b38c7cdebaf389c8d0a2

The problem is that this would require an update to netstandard2.0, as these APIs are only present on this version.

rogusdev commented 4 years ago

OK, after looking into this on: https://docs.microsoft.com/en-us/dotnet/api/system.environmentvariabletarget?view=netframework-4.8

This is a very weird MS only feature that is not really what env vars are, imo. So I don't feel too bad not supporting this. Env vars are env vars, there is no such thing as "process" vs "machine" outside of some weird Windows OS only concepts that I do not want to encourage.

Personally I love C#, but that does not mean I love everything MS does, and I wish Windows was the final say in OS but it definitely, definitely is not (no proper support for Unicode in terminal, no ability to run both Docker and Virtualbox on the same host, because Windows Hypervisor VM setup is busted :( ) so I am not going to claim they do everything perfect. This weird feature definitely falls in that bucket, imo.

If you really, really want to support it... well, I suppose we can upgrade the version in here and add the feature and let people raise an issue of backwards compatibility -- by this point, I imagine everyone should have upgraded already. Submit the PR and I'll approve and merge it.

Until then, I'm not going to lose sleep over this issue, sorry. Closing.