astro-cli icon indicating copy to clipboard operation
astro-cli copied to clipboard

SetCurrentContext and other context setters do not keep the struct up to date

Open kushalmalani opened this issue 3 years ago • 1 comments

An example of such issue is if I have a context that I got with c, err := config.GetCurrentContext(). I then change the user email in the config with c.SetContextKey("user_email", "[email protected]"). In order to get the updated context struct, I must call GetCurrentContext again, because the config was updated in the viper config file, but the data in the struct was not updated at the same time.

I'd like to keep this struct up to date as the context file changes so that this flow is no longer required. I believe that this makes a cleaner, more predictable dev experience.

original ticket - https://github.com/astronomer/cloud-cli/issues/268

kushalmalani avatar May 26 '22 19:05 kushalmalani

@alex-astronomer is there an example of this happening in the code somewhere?

sunkickr avatar Jun 10 '22 22:06 sunkickr