简体   繁体   中英

Node.js app detecting running on Azure

I'm writing a node.js app that I would like to be easily deployed on Azure as well as other platforms. How can I detect if I am running under Azure?

The environment does not seem to have any special variables. process.env.port contains the pipe such as \\\\\\\\.\\\\pipe\\\\2f95e604-fc02-4365-acfc-010a26242d02 which is all I can think of so far.

Detailed environment data is available through the azure module, but I only want to pull that in if I am running on Azure.

我不确定,但您尝试过process.platform吗?

老问题,但是我用这个:

if ('WEBSITE_NODE_DEFAULT_VERSION' in process.env) ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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