By nemo011
I am new to DevOps and all this. I am using an Ubuntu server to host my node.js application. Previously it was hosted in heroku. In heroku there is a special area to store environment variables, but I don’t know how to store it here. I have tried creating a variable and then exporting, but it gets flushed as the server restarts. Please, someone, help me out!
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!
Hello, if you are referring to the App Platform service of DigitalOcean, then we request you to refer to below link, which explains about the Environment variables:
https://www.digitalocean.com/docs/app-platform/how-to/use-environment-variables/
Cheers, Sri Charan
Hi @nemo011,
There are a few ways to load them up.
Environment variables can be access by the object process.env.NameOfVariable.
Having said that, I’ll recommend checking out the following tutorial as it will help you better understand how to call and actually work with variables in nodejs - Tutorial
Regards, KDSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.