0

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?

Community
  • 1
  • 1
Jadam
  • 1,650
  • 1
  • 19
  • 40
  • You appear to be completely confused about the very basic shell concepts. Read `man zsh` in full, especially the `STARTUP/SHUTDOWN FILES` section. – 4ae1e1 Oct 27 '15 at 19:14

1 Answers1

0

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.

Jadam
  • 1,650
  • 1
  • 19
  • 40