Add a configuration option to disable dotenv-expand if desired #22083
Replies: 4 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.
-
| no update on? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Please add a flag in
nx.jsonfor disabling the use ofdotenv-expandfor more advanced use cases. Example:{ "env": { "expand": "false" } }or we can simply set
NX_ENV_EXPAND=falseWhat we're solving for
We don't want
$signs to get expanded in the root.envsometimesMotivation
Many of our repos are multi-language, using the
@nx-dotnet/corepackage for .NET 8 projects for example. Sometimes, we might have a little Rust in there too :)All of our projects use a
Makefilewith 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.envand._shared_post.envand.<environment>.envfiles 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 >&2Beta Was this translation helpful? Give feedback.
All reactions