Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing a JSON file as environment variable in gcloud

Im trying to pass a secret into a Cloud Run run command. The secret is a json file. I want to pass it in as an environment variable.

It works great in docker using:

docker run -it -e "SECRET_ENV=$(<path/secretFile.json)" -p 8080:8080 my_image 

When I use the same method on gcloud I get an error that tells me its trying to run each line of the json file:

gcloud run deploy --image gcr.io/account/project --update-env-vars "SECRET_JSON=$(<path/secretFile.json)"

cheers

like image 736
abe Avatar asked Sep 05 '25 03:09

abe


1 Answers

Currently gcloud run deploy doesn't support setting environment variables through a json file. More information about environment variables on Cloud Run can be found here.

You may want to file a Feature Request for this improvement.

like image 62
tzovourn Avatar answered Sep 07 '25 20:09

tzovourn