Home > Back-end >  Environmental Variables in Digital Ocean Droplets
Environmental Variables in Digital Ocean Droplets

Time:03-06

I have a Node.js app that I want running on a Digital Ocean droplet, however, I have a few environmental variables that I need to be using. Is it safe for me to create a .env file on it to store the variables? (If no, how do I go about doing this?) Because I know that services like Heroku have a 'configuration variable' setting on their dashboard, whereas Digital Ocean doesn't

CodePudding user response:

Heroku is an app platform, not a VM, which is how they can inject your environment variables.

If it's on your machine, it's ok for you to create the file - it won't be accessible via the web (but it WILL be there).

Here's how to do it with the Digital Ocean App Platform (https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/), and here's how to do it with just a droplet (https://www.digitalocean.com/community/questions/how-can-i-set-environment-variable-in-droplet-not-using-app)

  • Related