Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for Default Environment Variable Value in ${localEnv:...} and ${containerEnv:...} #28

Closed
cmbrose opened this issue May 13, 2022 · 1 comment

Comments

@cmbrose
Copy link
Contributor

cmbrose commented May 13, 2022

I wasn't able to find anything suggesting this was possible, nor did it seem to work when I tried it myself.

I'd like to see the ability to specify a default value for local environment variable values in the runArgs property of the devcontainer.json file. I'm trying to use the value of a local env var to determine the filesystem source of a bind mount into the remote environment container, or default to a named volume if the variable does not exist.

I propose the ability to use the standard way of defining a default value for a shell/environment variable, with the <variable-name>:-<default-value>. I have tried this and it does not seem to work. An example is shown below for the runArgs property of the devcontainer.json file.

runArgs: [
    -v, ${env:DOES_NOT_EXIST:-name-of-volume-or-default-path}:/path/in/container/filesystem,
],
@cmbrose
Copy link
Contributor Author

cmbrose commented May 13, 2022

Ignore, this is from testing the migration and shouldn't have been created here

@cmbrose cmbrose closed this as completed May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant