Writing a CLI application in GoLang and want to use URL across different sessions/commands. Implementing CLI through Cobra where I want to configure URL at the beginning and then keep using it across other commands.
Tried to use below approach -
os.Setenv("URL", URL)
os.Getenv("URL")
Above approach works only inside the same process (doesn't work if set and get processes are different).
Any idea how can we do it ?
Update: I wanted to know if it's possible to be done inside Go? I know it can be easily done by storing it in file/db or even setting up in environment variable but exploring ways to do it in Go.