简体   繁体   English

Azure App Service中的process.env.NODE_ENV在哪里

[英]Where is process.env.NODE_ENV in Azure App Service

I'm using ExpressJS to connect the dots between NodeJS and my Angular app. 我正在使用ExpressJS将NodeJS和Angular应用之间的点连接起来。 I wanted to install this npm package norobot : to leverage the process object. 我想安装此npm软件包norobot :以利用process对象。

I'd like to know where/how to set the NODE_ENV in an App Service within Microsoft Azure. 我想知道在哪里/如何在Microsoft Azure的App Service中设置NODE_ENV

I was pointed here, https://docs.microsoft.com/en-us/azure/app-service/web-sites-configure#howtochangeconfig 我在这里被指出, https://docs.microsoft.com/zh-cn/azure/app-service/web-sites-configure#howtochangeconfig

But the current-day Azure portal looks significantly different versus what the documentation has supplied, leading me to a big disconnect. 但是,当前的Azure门户看上去与文档提供的门户截然不同,这使我陷入了极大的脱节。

If you could point me in the right direction, that'd be appreciated. 如果您能指出正确的方向,那将不胜感激。

Additional FYI, At run-time, my stack is running on Node.js 9.4. 附加的FYI,在运行时,我的堆栈在Node.js 9.4上运行。

I wanted to install this npm package norobot : to leverage the process object. 我想安装此npm软件包norobot :以利用过程对象。

norobot package has absolutely nothing to do with process . norobot软件包与process绝对无关。

But the current-day Azure portal looks significantly different versus what the documentation has supplied, leading me to a big disconnect. 但是,当前的Azure门户看上去与文档提供的门户截然不同,这使我陷入了极大的脱节。

Looks really shouldn't matter (to an extent), they serve as a visual guide. 看起来真的不重要(在一定程度上),它们充当视觉指南。

The key section of the guide/docs you posted is App Settings : 您发布的指南/文档的关键部分是“ 应用程序设置”

This section contains name/value pairs that your web app will load on start up. 本部分包含您的Web应用程序在启动时将加载的名称/值对。

  • PHP, Python, Java and Node applications can access these settings as environment variables at runtime . PHP,Python,Java和Node应用程序可以在运行时作为环境变量访问这些设置 For each app setting, two environment variables are created; 对于每个应用程序设置,都会创建两个环境变量。 one with the name specified by the app setting entry, and another with a prefix of APPSETTING_. 一个具有应用设置条目所指定的名称,另一个具有APPSETTING_前缀。 Both contain the same value. 两者都包含相同的值。

So following a similar answer: https://stackoverflow.com/a/34622196/2382650 所以遵循类似的答案: https : //stackoverflow.com/a/34622196/2382650

set: NODE_ENV : some_value as shown above and it will be availble in your Express app as process.env.NODE_ENV 设置: NODE_ENVsome_value ,它将在您的Express应用中作为process.env.NODE_ENV

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM