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:...} #50

Closed
botspaces opened this issue May 13, 2022 · 6 comments
Assignees
Labels
help wanted Extra attention is needed plan-item A plan item
Milestone

Comments

@botspaces
Copy link

botspaces commented May 13, 2022

@celestialorb microsoft/vscode-remote-release#1108 at 08/06/2019 11:25:45:

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,
],
@botspaces
Copy link
Author

@vscode-triage-bot commented at 10/21/2021 12:40:27:

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@botspaces
Copy link
Author

@MShekow commented at 11/09/2021 16:20:34:

We also would need this feature. What exactly is meant by "out of scope"?

@botspaces
Copy link
Author

@chrmarti commented at 11/10/2021 08:32:30:

"out of scope" because we never got to consider doing this. Reopening to reconsider.

@botspaces
Copy link
Author

@MShekow commented at 11/10/2021 09:58:21:

Thank you for reopening this ticket. Since the issue is quite old, having just consulted the docs, I suppose it makes sense to have this default-value mechanism implemented for localEnv and containerEnv, e.g. to be able to define something like ${localEnv:DOES_NOT_EXIST:-some default value}.

@botspaces
Copy link
Author

@firdacz commented at 05/03/2022 18:34:59:

Not just runArgs but everywhere - e.g. in launch.json:

\"serverpath\": \"${env:jlink:\"c:\Program Files (x86)\SEGGER\JLink_V...\"}/JLinkGDBServerCL.exe\",
\"armToolchainPath\": \"${env:gnuarm:\"c:\devel\gnuarm\"}/bin\",

...would probably need to be quoted (if containing : ...for future extensions, e.g. list of alternatives - checked for exists? I myself have that toolchain on either D: or E:, using company/home PC)

@Chuxel
Copy link
Member

Chuxel commented May 24, 2022

@chrmarti Given the help wanted message - should this be in the CLI repo? Or separated into a spec update and then the reference implementation?

@chrmarti chrmarti transferred this issue from devcontainers/spec Jun 9, 2022
@chrmarti chrmarti self-assigned this Jun 10, 2022
@chrmarti chrmarti added this to the June 2022 milestone Jun 10, 2022
@chrmarti chrmarti modified the milestones: June 2022, July 2022 Jul 1, 2022
@chrmarti chrmarti added feature-request New feature or request and removed enhancement labels Jul 19, 2022
@chrmarti chrmarti modified the milestones: July 2022, August 2022 Jul 22, 2022
@chrmarti chrmarti added plan-item A plan item and removed feature-request New feature or request labels Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed plan-item A plan item
Projects
None yet
Development

No branches or pull requests

3 participants