HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptCritical

Read environment variables in Node.js

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
environmentvariablesreadnode

Problem

Is there a way to read environment variables in Node.js code?

Like for example Python's os.environ['HOME'].

Solution

process.env.ENV_VARIABLE


Where ENV_VARIABLE is the name of the variable you wish to access.

See Node.js docs for process.env.

Code Snippets

process.env.ENV_VARIABLE

Context

Stack Overflow Q#4870328, score: 2207

Revisions (0)

No revisions yet.