How to define and use environment variable on GCP?

Actually, my understanding on how environment variables are propagated to children processes was inaccurate. As was the purpose of the url property in the server.js config.

I finally ended up with the following solution:

  • let server.url finally untouched (defaulting to ‘’)
  • use the process.env.WEBSITE variable directly where I need it
  • modify the start script in my package.json with this: ENV_PATH=${ENV_PATH:=./.env} strapi start
  • set ENV_PATH targeting a production environment file (.env.prod) in the app.yaml
  • set the WEBSITE variable in both .env and .env.prod files with appropriate values.

Not sure if that’s the optimal way of doing things, but this is solving the issue and allows me to keep my dev script in package.json unchanged (since it will use .env. by default).

1 Like