I am writing deployment script, it needs to perform based on the system variable. Is there any way to read specific environmental variable through chef recipe ?
我正在编写部署脚本,它需要根据系统变量执行。有没有办法通过厨师食谱阅读特定的环境变量?
1 个解决方案
#1
You can use Ruby native way to manage environmental variables (ruby-doc link). Thus you can reference a environmental variable from your recipe directly using ENV['MY_VARIABLE'].
您可以使用Ruby本机方式来管理环境变量(ruby-doc链接)。因此,您可以使用ENV ['MY_VARIABLE']直接从配方中引用环境变量。
#1
You can use Ruby native way to manage environmental variables (ruby-doc link). Thus you can reference a environmental variable from your recipe directly using ENV['MY_VARIABLE'].
您可以使用Ruby本机方式来管理环境变量(ruby-doc链接)。因此,您可以使用ENV ['MY_VARIABLE']直接从配方中引用环境变量。