How to define and use environment variable on GCP?

I am having the following /config/server.js file:

module.exports = ({ env }) => ({
  //...
  url: env('WEBSITE', 'http://localhost:1337'),
});

I set the url property since I need it for some use case.
I deploy my strapi instance on GCP app engine, the app.yaml looks like so:

runtime: nodejs12
instance_class: F2
env_variables:
  HOST: '0.0.0.0'
  NODE_ENV: 'production'
  // ...
  WEBSITE: 'https://my-website.com'

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.

System Information
  • Strapi Version: 3.3.3
  • Operating System: Windows 10
  • Database: mysql
  • Node Version: 14
  • NPM Version: 6
  • Yarn Version:

Can you check the output of process.env.WEBSITE?

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).