Report this

What is the reason for this report?

Adding .env file to DigitalOcean Ubuntu droplet

Posted on February 25, 2021

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?



This textbox defaults to using Markdown to format your 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:

https://devcenter.heroku.com/articles/config-vars

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.