0

I want to run google cloud function locally, using function maven plugin command as below

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. The system method System.getenv("VAR1") returning null value.

mvn function:run -DVAR1=value1 -DVAR2=value2 -DrunFunction.target=com.sample.MyFunction

Can anyone guide/correct me on this?

Pushparaj Dhole
  • 63
  • 1
  • 11

1 Answers1

0

To get the values you are passing using the -D flag, you will need to use System.getProperty() instead of System.getenv().

mgoya
  • 512
  • 3
  • 12