Are you trying to work out how to setup environment variables for your Digital Ocean droplet or app running on the app platform? Here’s how.
Digital Ocean droplet environment variables
Setting an environment variable for a droplet is a little more complicated than for an app running on the app platform.
Follow these steps to set environment variables on a Linux droplet:
- SSH into your droplet. If you’re not sure how to do that, see here
- Once connected, run the following command to set your environment variable:
App platform environment variables
To set environment variables for an app running on Digital Ocean’s app platform, follow these steps:
- Login to the Digital Ocean portal
- Open your app
- Click the “Settings” tab
- Scroll down until you see “App-Level Environment Variables”
- Click “Edit” and add the environment variable key and value
- Click “Save”
Your environment variable will now be available for your app.