[英]Running gcp cloud funtion locally using mvn function:run with ENV variables
I want to run google cloud function locally, using function maven plugin command as below我想在本地运行谷歌云 function,使用 function maven 插件命令如下
mvn function:run
While running this I am giving some env variables with below syntax but I am not able to read these values in my function code.在运行此程序时,我提供了一些具有以下语法的环境变量,但我无法在我的 function 代码中读取这些值。 The system method System.getenv("VAR1")
returning null value.系统方法System.getenv("VAR1")
返回 null 值。
mvn function:run -DVAR1=value1 -DVAR2=value2 -DrunFunction.target=com.sample.MyFunction
Can anyone guide/correct me on this?任何人都可以指导/纠正我吗?
To get the values you are passing using the -D flag , you will need to use System.getProperty()
instead of System.getenv()
.要使用 -D 标志获取您传递的值,您需要使用System.getProperty()
而不是System.getenv()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.