Developer concepts

What are environment variables?

A named value that lives outside your code, in the environment the program runs in.

Your app needs a database password and an API key. Writing them straight into your code is one of the most common security mistakes there is.

What it is

An environment variable is a named value that lives outside your code, in the environment the program runs in.

How it works

Your code asks for a name, like DATABASE_URL, and the system hands it the value. On your laptop, the values might come from a .env file that never gets committed. In production, the hosting platform sets them. Same code, different values in each place.

Why it matters

Secrets stay out of Git, and you can point the same app at a test database or the real one without changing a line.

More from The Benmore Brief on YouTube

Put AI to work in your business.

Benmore's forward deployed engineers build and connect the software, from discovery to deployment.

Talk to us