I deployed my Node js app to DigitalOcean Ubuntu droplet.
The app needs the variables in my .env file. How can I create those variables in DigitalOcean droplet please?
How did you deploy your app to the Droplet?
You should be able to copy a .env
file to the Droplet using the same mechanism that you copied the NodeJS files to the Droplet.
The simplest way to copy files securely is to use scp
.
The syntax is:
scp \
-i /path/to/your/ssh_private_key \
path/to/your/.env \
root@[droplet-ip]:/path/to/your/app
NOTE this will copy the
.env
file into yourapp
directory.
If you are not using ssh keys with your Droplet (and you should), you can read how to add ssh keys either to an existing or new Droplet.