Add a configuration option to disable dotenv-expand if desired #22083
Replies: 3 comments 1 reply
-
You can workaround expansion by using the |
Beta Was this translation helpful? Give feedback.
-
I converted this to a discussion, if enough people need the feature and can list out use cases where it is absolutely needed, then we can take a look. |
Beta Was this translation helpful? Give feedback.
-
This is problematic for us. Our env vars come from Vault, a hosted service. The expand is only an issue in local development when we use NX to serve the app. It is not an issue in production where we only use NX to build the app, but we just run |
Beta Was this translation helpful? Give feedback.
-
Description
Please add a flag in
nx.json
for disabling the use ofdotenv-expand
for more advanced use cases. Example:or we can simply set
NX_ENV_EXPAND=false
What we're solving for
We don't want
$
signs to get expanded in the root.env
sometimesMotivation
Many of our repos are multi-language, using the
@nx-dotnet/core
package for .NET 8 projects for example. Sometimes, we might have a little Rust in there too :)All of our projects use a
Makefile
with documented commands. Here is a common setup:(notice this line specifically
bunx --bun dotenv-cli -e .config/environment/._shared_pre.env -e .config/environment/.$(environment).env -e .config/environment/._shared_post.env -- bun --bun ./tmp/dotenv-expand-transpiler.ts $(DOTENV_EXPAND_PREFIXES) ./ .env false >&2
)We like to have
._shared_pre.env
and._shared_post.env
and.<environment>.env
files to transform the variables ahead of time and drop it to the root.env
.bunx --bun dotenv-cli -e .config/environment/._shared_pre.env -e .config/environment/.$(environment).env -e .config/environment/._shared_post.env -- bun --bun ./tmp/dotenv-expand-transpiler.ts $(DOTENV_EXPAND_PREFIXES) ./ .env false >&2
Beta Was this translation helpful? Give feedback.
All reactions