lundi 12 octobre 2015

Set node.js process.env variables under AWS Elastic Beanstalk

I'm trying to propagate Jenkins-build-specific environment variable(s) into a node.js server so that it's possible to know which build#/git-branch/commit-sha the AWS elastic beanstalk environment is running.

Following various AWS guides I've created a file which contains the environment variable(s). The intention is to have the values in the file replaced during the build process so that they reflect build-specific info:

$ cat .ebextensions/env.config
option_settings:
  - namespace: aws:elasticbeanstalk:application:environment
    option_name: BUILD_NUMBER
    value: BUILD_NUMBER_VALUE

Problem is that when the node instance fires up on the EBS environment, process.env.BUILD_NUMBER is not set (that is confirmed by a console.log(process.env) from within the node server).

Any idea what's missing in this configuration for the environment variable(s) to show under Node's process.env?

Notes:

  • It appears that the namespace is not mandatory. To be on the safe side I tried both with and w/o it, there was no difference



Aucun commentaire:

Enregistrer un commentaire