-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow files to be optional #41
Comments
Maybe a slightly better approach would be to auto-attempt to load I'm a bit hesitant to add more complexity as the usage patterns here are generally pretty consistent. Outside of |
I would actually advocate for not auto-attempting anything (other than perhaps the namesake
or in practice, more likely pivoting off of the config-env, e.g.
But I think it would be more elegant to somehow allow a list of optional files so the loading doesn't stop if a file doesn't exist. I.e. instead of the manual checking, just do:
Requiring specific ENV vars to be set makes sense... requiring a specific file to exist does not IMO. One should be able to manually set ENV vars and skip the dot-file altogether, for example. So being able to provide a list of files which may or may not be present would make for a nicer interface IMO. Hope my reasoning makes sense. |
I'm not against additional a I do think the overall better approach is to pattern off of the ruby dotenv implementation and auto-load a set of files for users (ruby => elixir users will expect this, it uses a convention over configuration preference, and it avoids having the user manage another couple lines of config). That being said, this can be another future change that could be handled separately. |
It would be nice if you could provide a list of optional files (something like how
vapor
defines a hierarchy of files -- see https://hexdocs.pm/vapor/Vapor.Provider.Dotenv.html#module-file-hierarchy) so you can easily allow users to override default configurations with more specific options. I don't think it's wise to hard-code a list of files that will be looked for -- I think it's a lot nicer (and easier) if you let users supply their own hierarchy of files.Currently, the following generates an error:
I think perhaps the default behavior should be to just quietly ignore a missing file. It would be nice to have an option to enforce that the files exist, e.g. maybe something like:
The text was updated successfully, but these errors were encountered: