Replies: 1 comment 4 replies
-
@djfo this is a great suggestion. Thanks @djfo. Others have mentioned this as well. It's something we will try to work on soon. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everybody,
this is the first time I use the Discussions feature and also the first time I'm trying to participate in the development of the
dotenv
package.I have a suggestion related to the interface/API of the package.
The package exports the functions
parse
andconfig
, whereparse
parses the contents of a.env
file andconfig
updatesprocess.env
based on the key-value pairs read from the.env
file.Since
config
is implemented usingparse
, I hoped to also find a function that parses the.env
file (taking a configuration as an argument likeconfig
) and returns aDotenvParseOutput
, without updatingprocess.env
. Or alternatively, a function that loads the contents of.env
(according to the configuration) and returns a string or buffer (essentially something that can be passed toparse
in turn).However, there is no such function.
I suggest to add this function, maybe named
load
, with the same interface asconfig
, but not updatingprocess.env
:It is easily implemented in code using the
dotenv
package, but I think it would make a nice addition to the package.Rationale: I expect that a simple call to
config
is the main use case for this package. However, sometimes side-effect-free loading of.env
(in the sense of only loading the key-value pairs without updating the environment) may be desirable.Please let me know if such a change is welcome, I'd be happy to open a corresponding PR if so.
Beta Was this translation helpful? Give feedback.
All reactions