Reputation: 1755
It was suggested to me to utilize ZSH for storing environment variables for a project I'm working on. When I set them with export VAR_NAME='secret_key'
on the command line it works, but does not persist beyond that shell session.
Reading around it sounds like I should be adding them in a .zshenv
file. That file does not appear to exist for me. Not sure how where to create that file in my $PATH. Contrary to that approach I was told just to use my .zshrc
file. Though when I add my env vars in there export VAR_NAME='secret_key'
they are not picked up by my application like they were when I ran that syntax from the command line.
I'm kinda lost in what is the best approach for this, and how to get it done.
Couple resources I've been reading though:
http://zsh.sourceforge.net/Guide/zshguide02.html
Where to place $PATH variable assertions in zsh?
Upvotes: 0
Views: 2240
Reputation: 1755
Closed everything down and walked away for the day. Came back this morning and it just worked. C'est la vie. Not sure what it was as I killed the server a few times trying to figure it out, but it is working now. Still not sure if saving those env vars in the .zshrc
file is best practice. Or if another location is more ideal.
Upvotes: 0