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
String values in the devcontainer.json can contain ${localEnv:ENV_VAR} and ${containerEnv:ENV_VAR} placeholders which are replaced with the (either the local or the container) ENV_VAR environment variable's value at runtime. The goal is to allow for a default value to be specified as part of the syntax that will be used when the ENV_VAR is not set.
Proposal
The proposal is to add an optional default value separated by a second colon in the existing notation: ${localEnv:ENV_VAR:default_value} and ${containerEnv:ENV_VAR:default_value} and to replace the notation with the default value when there is no ENV_VAR environment variable at runtime. The existing behavior without a default value remains unchanged.
Notes
We have a PR from the community implementing this proposal: devcontainers/cli#51
The text was updated successfully, but these errors were encountered:
On the potential need to escape : when it is part of an environment variable name: I can't find a way to use : as part of an environment variable's name in Bash or /bin/sh. When spawning a process without shell, it is possible to use : in a variable name. Given the difficulty in using it (i.e., unsupported in common shells), I suggest we don't need to support it. /cc @jkeech
(REMOVED: The original ask was to use :- as the separator to align with common shell syntax. Updating to that.)
Goal
String values in the devcontainer.json can contain
${localEnv:ENV_VAR}
and${containerEnv:ENV_VAR}
placeholders which are replaced with the (either the local or the container)ENV_VAR
environment variable's value at runtime. The goal is to allow for a default value to be specified as part of the syntax that will be used when theENV_VAR
is not set.Proposal
The proposal is to add an optional default value separated by a second colon in the existing notation:
${localEnv:ENV_VAR:default_value}
and${containerEnv:ENV_VAR:default_value}
and to replace the notation with the default value when there is noENV_VAR
environment variable at runtime. The existing behavior without a default value remains unchanged.Notes
We have a PR from the community implementing this proposal: devcontainers/cli#51
The text was updated successfully, but these errors were encountered: