cli
cli copied to clipboard
Dynamic Environment Variable
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?
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"