Hi, I need to set environment variables up on my vps for my node server to use. Anybody know if this is possible and if it’s secure? If this I possible how would I set the environment variables up? Thanks in advance.
Yes it’s possible. It’s secure, although how secure it is depends on the particulars of your setup. (It’s more secure than, say, checking a configuration file in to GitHub.)
- SSH into your VPS and create a file named
- Add your variables in the form
export VARIABLENAME=VALUE(Note that there are no spaces on either side of the =. That’s important.)
source .envto load the file into your shell.
Now your environment variables should be available to Node (and to other child processes).
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.