Add ability to load azd env vars into shell#4078
Conversation
|
@pamelafox - Once we get a build of azd for this PR can you try it out to see if that helps with your env path scenario? |
|
@pamelafox - I also added a new export option to get-values that allows you to eval and set the context. For example:
will output: So, you can now do: source <(azd env get-values -o export)
python.pyapp.py And that will display the value from the python app. I'm thinking this will work well for apps that have a startup script like a package.json or a python setup file. I think this will do away with this type of code: https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/scripts/load_azd_env.sh |
|
I would be too afraid to use the -export option, as I keep getting into nasty situations due to lingering exported environment variables from previous exports (like from load_azd_env). I'm trying to move away from export in all the repos now. |
|
I've tried this out, and it works well for the positive case, but for the case that nothing satifies the JMESpath query, it seems to give back the string "null" as a result. Is that expected? Feels a bit odd. |
I'd like to hear more details on what you are facing with exports. |
|
@jongio When I export the whole environment, and then I do an "azd env set" to another environment, the previous env variables are still around, so my subsequent actions are affected by anything that was set there (particular anything that main.parameters.json or my hooks use). I have to then explicitly unset every variable to get things back to a clean state. |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
|
Hi @jongio. Thank you for your interest in helping to improve the Azure Developer CLI experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
|
Hi @jongio. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing "/reopen" if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the "no-recent-activity" label; otherwise, this is likely to be closed again with the next cleanup pass. |
Fixes #4067
Currently adds -o export to get-values. We are evaluating other methods / interfaces as well.