cli icon indicating copy to clipboard operation
cli copied to clipboard

Dynamic Environment Variable

Open devhl-labs opened this issue 1 year ago • 1 comments

I need to connect to a private Azure Devops artifact feed when my devcontainer starts. The command looks like this

CARGO_REGISTRIES_MYPROJECT_PUBLICPACKAGES_TOKEN="$(az account get-access-token --query "join(' ', ['Bearer', accessToken])" --output tsv)"

How can I get this set so it's not just the literal string?

devhl-labs avatar May 03 '24 22:05 devhl-labs

You could add it to the container's ~/.bashrc either from your Dockerfile or the devcontainer.json. E.g., in the devcontainer.json add:

"postCreateCommand": "echo 'export TOKEN=\"$(az account ...)\"' >>~/.bashrc"

chrmarti avatar May 08 '24 07:05 chrmarti