The environment variable WEBSITE is not taken into account on my GCP instance though , since url still equals http://localhost:1337 (which is the default from server.js) and I don’t understand why.
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).
This was a year ago and I moved my instance to Heroku, so I don’t know if that’s still up-to-date. You can see that the node runtime is v12 for instance. Anyway, this is what my app.yaml looked like. I hope that can help: