fix(config): Make SetEnv invalidate cache used by GetEnv
Created by: andhe
The golden rule about caches is that if there's no way to invalidate them then they're broken...
And indeed if config.SetEnv("foo", ...) is called followed by config.GetEnv("foo") then you'll get the old value (when both read/write from the same file). And example of this is on clean start where initConfig sets up the default values for missing/empty env vars.
A testcase for this:
rm -rf ~/.config/glab-cli/ .glab-cli/config/.env
./bin/glab config --global
Before this patch it would say:
? Enter default Gitlab Host (Current Value: ):
After patch it correctly lists the default/current value as set by initConfig():
? Enter default Gitlab Host (Current Value: https://gitlab.com):