Skip to content

feat(config): Determine the GCP region from the `RUNTIME_REGION` environment variable.

Florian Forster requested to merge fforster/runtime_regions into main

What does this merge request do and why?

feat(config): Determine the GCP region from the RUNTIME_REGION environment variable.

With this change, when the "location" or "endpoint" config options are not provided, they are initialized based on the region in which the application runs. The config code uses the RUNTIME_REGION environment variable to determine the GCP region it is running in.

How to set up and validate locally

The new code depends on the Cloud Run metadata server, which is not available locally. However, you can set

K_SERVICE=test
RUNTIME_GCP_REGION=false

to verify that a failure to look up the region does not impact the service start-up when RUNTIME_GCP_REGION is disabled.

Issue: gitlab-com/gl-infra/platform/runway/team#184 (closed)

Status

Updated: 2024-04-16
TLDR: The approach has been simplified in accordance with feedback to just patch through an environment variable.

Full update in #note_1864590010.

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Florian Forster

Merge request reports