Adding .env file to DigitalOcean Ubuntu droplet

I am deploying an MERN application to DigitalOcean for the first time. I’ve previously always deployed my apps via Heroku. I’m trying to figure out the best way to handle the variables in the .env file. Is it okay to directly upload a .env file to the DO server? Will those variables remain private? If so, can anyone point me in the right direction for creating a .env file with the variable information in it from an Ubuntu command line?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

If you’re using an deployment pipeline, then Heroku allows you to setup config vars - take a look here: