Skip to content

LAB6_Set environment variables in Netlify

David Jones-Gilardi edited this page Feb 22, 2021 · 9 revisions

⚒️ Set environment variables in Netlify

Exercise time: ~5 minutes

Objectives

In this step, we will:

  • Set environment variables in Netlify for database connectivity in production deployments

We will cover:

  1. Set environment variables in Netlify
  2. Verify your environment variables

✅ Step 1: Set environment variables in Netlify

✔ Go back to Netlify and navigate to Site settings in the toolbar, then choose Build & deploy from the menu on the left.

Netlify vars site settings

✔ Scroll down to the Environment variables section and choose Edit variables.

Netlify vars build edit

✔ Click New variable to add each key/value pair, one for each variable listed below.

ASTRA_DB_USERNAME=battle_user
ASTRA_DB_PASSWORD=battle_password1
ASTRA_DB_KEYSPACE=battlestax
ASTRA_DB_ID=[the value you retrieved above from YOUR database]
ASTRA_DB_REGION=[the value you retrieved above from YOUR database]
GAMES_COLLECTION=games

✅ Step 2: Verify your environment variables

You should now have something like:

Netlify vars build edit save

✔ Once complete click Save and you are good to go.

Clone this wiki locally