Closed LewisWolfgang closed 4 years ago
I think I'm not quite understanding your issue, auto-configuration fails silently if there is no .env
file available.
In case you want to use any other filename as your dotenv file, simply use the load_dotenv()
function with its full_path
variable set to wherever your file is located and it should be loaded without problems.
In case I'm not properly understanding the issue, please provide some more details.
Hi. Thanks for looking at this. In my case, I have a main program, using a .env
file in the current directory. I also have some utilities in the same directory, and they are using this code to load variables from a differently named file. (And I prefer them to not load things from .env
.
My thought is that it is cleaner to have an explicit call to load the .env
file, rather than having this happen automatically when the header is included. Of course, this is just my opinion.
I have to say, I've thought about it a couple of times since I coded that part, and nowadays I have to admit that I agree more with you than with my past self. It is better if libraries keep "magic" levels as low as possible, and implicit (but not essential) behavior does not exactly help with that.
I'll probably introduce the changes with the 0.3.0 version that I'm preparing now with many changes on the parsing part.
I'll leave the issue open until I commit the changes to dev
so I don't lose track of it.
I'm definitely dropping the auto-configuration on the next release: when making the switch to the ANTLR4-generated parser, I had to introduce some changes that at their turn introduced me to the world of deferred dynamic initialization and the static initialization order fiasco in C++, which were caused by the auto-configuration.
A real pain to detect, locate and solve.
Changes introduced with commit ca7ea11cfdebfc35851f3d191fd40814ee711c36 on the antlr
branch, still to be merged to dev
and, from there, to master
, waiting for v0.3.0
release.
Closing the issue meanwhile.
This is more of an issue now that the code is automatically populating the environment.