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

Feature: support setting multiple environment key-value pairs or from file #4941

Open
JeffreyCA opened this issue Mar 13, 2025 · 2 comments · May be fixed by #4942
Open

Feature: support setting multiple environment key-value pairs or from file #4941

JeffreyCA opened this issue Mar 13, 2025 · 2 comments · May be fixed by #4942
Assignees
Milestone

Comments

@JeffreyCA
Copy link
Contributor

It would be useful to be able to set multiple environment key-value pairs with a single command, something like:

azd env set KEY1 val1 KEY2 val2 ...

Or additionally, loading environment values from an external file (related to #4935 but outside of azd init), like:

azd env set --file .env
@JeffreyCA JeffreyCA added this to the Backlog milestone Mar 13, 2025
@JeffreyCA JeffreyCA linked a pull request Mar 13, 2025 that will close this issue
@weikanglim
Copy link
Contributor

weikanglim commented Mar 17, 2025

Just curious to learn from @JeffreyCA the scenario you ran into that pushed towards the consideration of azd env set <key> <value> <key> <value>.

I could see azd env set --file .env or something similar for programmatic purposes, but it feels that for a general terminal experience azd env set <key> <value> is more readable than the proposed shorthand.

I notably find whitespace delimiter being used for key|value and key-value|key-value is giving me a little pause.

@JeffreyCA
Copy link
Contributor Author

The scenario is being able to set multiple environment key-value pairs in one command. Alternating key/value was the first approach that came to my mind initially. Now that I think about it, that may have been influenced by my experience with the Redis API, which uses a similar syntax in some commands like MSET.

It looks like many other CLIs (az cli, kubectl) adopt a different syntax like key=value key2=value2, which I think is worth exploring further and might feel better as well.

What do you think about something like:

Command Description
azd env set <key> <value> Set a single environment variable
azd env set <key>=<value> <key2>=<value2> ... <keyN>=<valueN> Set 1 or more environment variables
azd env set --file <filepath> From file, maybe -f as shorthand

@JeffreyCA JeffreyCA self-assigned this Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants