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

No error given for missing .env file #24

Open
arnholm opened this issue Dec 31, 2021 · 2 comments
Open

No error given for missing .env file #24

arnholm opened this issue Dec 31, 2021 · 2 comments

Comments

@arnholm
Copy link

arnholm commented Dec 31, 2021

Thanks for a great library!

I noticed that if the .env file does not exist, it is silently ignored and there is no way to check if the file was actually found. I think the dotenv class should keep a status value to indicate if the file was found & parsed or not. There should be a way to query the status, for example:

env.load_dotenv();
if(!env.good()) throw std::runtime_error(".env file was not found"):
@vansoest
Copy link

+1

@GaeaKat
Copy link

GaeaKat commented Apr 10, 2023

I think if added it should be more like env.file_found() some setups like docker compose, might pass all the settings through system enviroment, so you can have a valid config with no .env file

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

No branches or pull requests

3 participants