Environment Variable

noun

say it: “en-VY-run-ment VAIR-ee-uh-bul” /ɛnˈvaɪrənmənt ˈvɛəriəbəl/

A named setting kept outside a program, in the computer or server it runs on, where secrets such as API keys and passwords belong.

What is an environment variable?

An environment variable is a setting stored outside your code, in the computer or server, which is the safe place for passwords and API keys.

import os
api_key = os.environ.get("WEATHER_API_KEY")
if api_key is None:
    print("Set WEATHER_API_KEY first")

In a sentence

  • “On Render, Neha set the environment variable DATABASE_URL in the dashboard.”
  • “The JWT secret comes from an environment variable, never from the code.”

Level: Journeyman · More Python terms at this level

Updated

In other subjects