V
V
Vitaly2015-10-27 16:11:19
JavaScript
Vitaly, 2015-10-27 16:11:19

How to change process.env values ​​to production defaults?

There is a node express application, I want to assign production values ​​to env. Where is the value of this variable generally stored?
I know you can specify in pakage.json:

"scripts": {
    "start": "NODE_ENV=production ..."

I also want to configure so that, for example, when launching forever app.js, the application starts with production values

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2015-10-27
@k12th

This is the value of the environment variable. For unixes here: www.cyberciti.biz/faq/set-environment-variable-unix , for Windows via GUI.
To set the variable when launching via forever, you can add the script to package.json:
"forever": "NODE_ENV=production forever app.js".

A
Aves, 2015-10-27
@Aves

To set the default, you need to execute in the console export NODE_ENV=production, this will set the variable for all child processes, or add this line to .bashrc, then it will be set for all user processes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question