-
Notifications
You must be signed in to change notification settings - Fork 229
Update env set
to accept multiple key-value pairs
#4942
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
base: main
Are you sure you want to change the base?
Conversation
80a59a1
to
2a80517
Compare
3a37be6
to
15ff91d
Compare
15ff91d
to
7601c33
Compare
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash:
pwsh:
WindowsPowerShell install
MSI install
Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
} else if len(e.args) == 2 && !strings.Contains(e.args[0], "=") { | ||
// Handle single key-value pair format: azd env set key value | ||
key := e.args[0] | ||
value := e.args[1] | ||
keyValues[key] = value | ||
} else { | ||
// Handle key=value format: azd env set key=value [key2=value2 ...] | ||
for _, arg := range e.args { | ||
key, value, err := parseKeyValue(arg) | ||
if err != nil { | ||
return nil, err | ||
} | ||
keyValues[key] = value | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would also support multiple syntax like azd env set key1 value1 key2 value2
or would we require =
for setting multiple values like azd env set key1=value1 key2=value2
?
Closes #4941
This PR introduces 2 additional syntaxes to the
env set
command to allow setting multiple key-value pairs at once and loading key-value pairs from a .env-formatted file:Set multiple key-value pairs
azd env set <key>=<value> <key2>=<value2> ... <keyN>=<valueN>
Load from .env-formatted file
azd env set --file <filepath>
Note
The existing syntax
azd env set <key> <value>
is still supported, for setting a single key-value pair.