I am on Windows (if that matters).
Inside my program i.e. myApp.run() I am checking content of a certain env. variable e.g.
env_var = get(ENV, "XYZ", "8073")
From command prompt/terminal in VS Code, before I execute julia, I call
set XYZ=5555
but then inside julia, inside myApp.run(), env_var is set to default 8073, which means it didn’t find any XYZ env. variable. And when I do
println(ENV)
inside that function, XYZ is not listed. However, other env. variables seem to be there.
How should I understand this? What variables are listed, and why is not my XYZ not there? Is there special julia command line argument to enforce env. variable?
Sorry for this small advertisement, but since you said, that you are checking variables inside your application, I presume you want to store some secrets in ENV and use them later. If it is a case, you can use ConfigEnv.jl. I am finalizing documentation, but main idea is that you save necessary environment data in .env (or any other file of your choice), put it in .gitignore and use it to populate ENV with dotenv() command in your application. It’s very simple and working on all platforms.
Environment variable TEST is now propagated into any terminal you open in VSCode, including the Julia REPL started with View → Command Palette… “Julia: Start REPL”
I also found out why SET command didn’t work for me.
In VS Code, terminal is powershell, not command.com, thus SET XYZ=5555 does something very different there. Command to set env. variable there is