如何使用环境变量嵌套
spursy opened this issue · comments
- 获取全局变量:${vars.*}
- 获取当前机器中的环境变量:${env(环境变量)}
如下:
vars: #公共全局变量
region: cn-hongkong
service:
test: "test-role"
prod: "prod-role"
机器中的环境变量是 test 或 prod,我如何根据机器中的环境变量获取全局环境变量中对应的 role?
目前vars还不支持嵌套写法。可以尝试维护两个test,prod文件,内容就是role字符串,然后使用${file}
语法读取。比如:
...
role: ${file(env('ENV'))}
...