How Nodejs process.env works

  containers, docker, node.js

I have a ENVIRONMENT Variable , which resolves the current stage inside the container in kubernetes.
when i refer the variable inside code it always prints "dev" even when the actual value refers to "stage". inside container .

my helm variables :

profiles:
  - node
owner:
  group: gcp-admin # change to your own group
notify:
  slack:
    channelName: XXXXXXXX-ingestion # change to your own slack channel

build:
  docker:
    app:
      runtime: node
      buildArgs:
        nodeVersion: 14.17.1
        buildDir: '.'
deploy:
  helm:
    values:
      env:
        ENVIRONMENT: stage

my java script code goes like this..

env: process.env.ENVIRONMENT

when i write console.log(env) it always prints dev.
the below image is what i get when i run describe pod

enter image description here

Source: Docker Questions

LEAVE A COMMENT