简体   繁体   English

从nodejs访问azure app设置环境变量

[英]Access to azure app setting environment variables from nodejs

I set environment variables in the azure app service through the settings我通过设置在azure app服务中设置环境变量在此处输入图像描述

and I want to change to the environment variable I created through the code How can it be accessed?而我想改成我通过代码创建的环境变量怎么访问? something like this像这样的东西

app.listen(PORT, () => {
      console.log(`Example app listening at http://localhost:${config.PORT}`)
    });

but it not recognizes the variable PORT但它不识别变量 PORT

Similarly how you access environment variables in your local environment, You need to use process.env.ENV_VARIABLE to read environment variables in Node .同样,您如何访问本地环境中的环境变量,您需要使用process.env.ENV_VARIABLE来读取Node中的环境变量。

var port = process.env.PORT;

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

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