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
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 and config, where parse parses the contents of a .env file and config updates process.env based on the key-value pairs read from the .env file.
Since config is implemented using parse, I hoped to also find a function that parses the .env file (taking a configuration as an argument like config) and returns a DotenvParseOutput, without updating process.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 to parse in turn).
However, there is no such function.
I suggest to add this function, maybe named load, with the same interface as config, but not updating process.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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
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
dotenvpackage.I have a suggestion related to the interface/API of the package.
The package exports the functions
parseandconfig, whereparseparses the contents of a.envfile andconfigupdatesprocess.envbased on the key-value pairs read from the.envfile.Since
configis implemented usingparse, I hoped to also find a function that parses the.envfile (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 toparsein 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
dotenvpackage, but I think it would make a nice addition to the package.Rationale: I expect that a simple call to
configis 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.
All reactions