Environment Variable
Subject: Computer and Technology noun /ɪnˈvaɪ.rən.mənt ˈvɛr.i.ə.bəl/ 1 definition
- operating-systems
- configuration-management
- systems-programming
- software-deployment
-
Definition (noun)
Entry #133 · UpdatedAn Environment Variable is a dynamic, named key-value string maintained within a process's runtime environment and inherited from its parent process or operating system shell. It provides a standardized interface for passing system paths, execution flags, service endpoints, and credentials into applications at launch without hardcoding host-specific settings into source code or recompiling binaries. Because each newly spawned process receives an isolated copy of its parent's environment block, modifications made by a child process stay confined to its own process tree rather than mutating global or parent state, establishing a clear boundary between external runtime configuration and persistent cross-process data storage.
Common Forms
System-Wide Variables: Persistent variables defined at the operating system level—such as in
/etc/environmenton Linux or Windows system properties—that supply shared defaults likePATHacross all users and background services.User and Shell Session Variables: Variables initialized in user login profiles or exported inside an interactive shell (for example,
export LOG_LEVEL=debug) that persist for the lifetime of that session and propagate to child commands.Process-Scoped Inline Variables: Ephemeral overrides prepended to a single command invocation (such as
PORT=8080 node server.js) or passed explicitly to a process-spawning API so they apply strictly to that one execution.File-Backed and Orchestrated Variables: Configuration entries loaded from
.envfiles during local development or injected dynamically at startup by container runtimes, CI/CD pipelines, and orchestrators like Kubernetes to separate deployment settings and secrets from application artifacts.
Example
When a containerized Node.js web service starts in production, Kubernetes injects
DATABASE_URLandPORT=8080as environment variables into the container's runtime environment rather than baking credentials into the image. At startup, the application readsprocess.env.DATABASE_URLandprocess.env.PORTto connect to the managed PostgreSQL database and bind its HTTP listener, allowing the exact same container image to run unchanged across staging and production.