You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling Dotenv.configure().filename(F), there is no check if F is an absolute path, leading to always prepending ./, except of course directory() is called with "" as argument.
I don't believe this to be a bug, but this could be improved with a simple check on the filename argument.
I think I misread the filename method's documentation, maybe I thought that the argument was a path when it was just a name.
I don't think a validation in method filename is required, null and non-empty validations would be much better than validating that the argument is not a path. I don't see any code dealing with a null or empty filename.
Activity
cdimascio commentedon Mar 19, 2025
@saiema thanks for the ticket. note that
filenameshould not be a file path, but simply a filename. docit is used when the name of the
.envis something other than.env, for instanceenvormy-custom-env-file.ext, etcdirectory (doc) is help Dotenv find the
.envfile.does this help? perhaps some validation to ensure
Finfilename(F)is not a path may help avoid confusion.saiema commentedon Mar 19, 2025
Dear @cdimascio,
I think I misread the
filenamemethod's documentation, maybe I thought that the argument was a path when it was just a name.I don't think a validation in method
filenameis required,nulland non-empty validations would be much better than validating that the argument is not a path. I don't see any code dealing with anullor empty filename.Kind regards.