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
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
Currently the default parser, dotenv, fails to correctly parse my config file. In particular, it does not support parsing escaped JSON (see motdotla/dotenv#771).
I'm using projen to create the file, which uses the ini library to do so. However, the output files that it creates are not always directly compatible with dotenv as a parser.
The ini parser also supports writing objects as section headers, and then supports parsing them back as well. This is potentially nice functionality to support as well.
Describe the solution you'd like
A new option on ConfigModuleOptions to specify the parser. The default would be the current dotenv parser, but the ini parser would be another option. If necessary, further parser options could be added in the future.
Alternatively, the config option could be the parser function itself. This would enable a BYO parser approach, and not require this library to add any extra dependencies
As far as I can tell, the variable expansion behavior can continue working as is using dotenv-expand without any issue.
It should be relatively straightforward to add a section to the docs explaining the parser options, and reasons why the ini parser may be preferred over the dotenv parser.
What is the motivation / use case for changing the behavior?
See the problem section above.
The text was updated successfully, but these errors were encountered:
V3RON
added a commit
to V3RON/nest-config
that referenced
this issue
Mar 4, 2024
This commit introduces a new configuration property named parser in ConfigModule, enabling
the injection of custom parser functions. If not specified, the default implementation,
backed by dotenv, is utilized.
closesnestjs#1444
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
Currently the default parser,
dotenv
, fails to correctly parse my config file. In particular, it does not support parsing escaped JSON (see motdotla/dotenv#771).I'm using projen to create the file, which uses the ini library to do so. However, the output files that it creates are not always directly compatible with
dotenv
as a parser.The
ini
parser also supports writing objects as section headers, and then supports parsing them back as well. This is potentially nice functionality to support as well.Describe the solution you'd like
A new option on
ConfigModuleOptions
to specify the parser. The default would be the current dotenv parser, but the ini parser would be another option. If necessary, further parser options could be added in the future.Alternatively, the config option could be the parser function itself. This would enable a BYO parser approach, and not require this library to add any extra dependencies
As far as I can tell, the variable expansion behavior can continue working as is using
dotenv-expand
without any issue.Teachability, documentation, adoption, migration strategy
It should be relatively straightforward to add a section to the docs explaining the parser options, and reasons why the ini parser may be preferred over the dotenv parser.
What is the motivation / use case for changing the behavior?
See the problem section above.
The text was updated successfully, but these errors were encountered: