How to use environment variables in package.json

后端 未结 6 1781
有刺的猬
有刺的猬 2020-12-30 19:01

Because we don\'t want sensitive data in the project code, including the package.json file, using environment variables would be a logical choice in my opinion.

Exam

6条回答
  •  温柔的废话
    2020-12-30 19:41

    Let's use grep to get a value environment variable from the .env file.

    "scripts": {
        "start": "NODE_ENV=$(grep NODE_ENV .env | cut -d '=' -f2) some_script"
    }
    

提交回复
热议问题