Hello Everyone, PR 27407 <https://github.com/apache/beam/pull/27407> is a Go implementation of an environment variable type.
This PR is one of many that implements the support infrastructure needed to collect data on Beam's reading from and writing to APIs (see PR's linked issue for context). While the study is finished and will be reported soon, the large draft PR is now being broken into smaller, more easily reviewed PRs. *For those interested in why* The study employs the Dataflow runner to collect data on errors associated with API overusage. Therefore the study's support infrastructure targets Google Kubernetes Engine (GKE) as the architecture to deploy and expose a quota aware gRPC endpoint implemented using Go. Deploying workloads requires specifying what is called a template so that Kubernetes knows what container image and configuration parameters such as command-line arguments or environment variables to set when it executes the application. When targeting Kubernetes, environment variables present a cleaner way over command-line arguments. However, in Go (as well as other languages) an environment variable key and its value are both strings. As the number of variables grows, it becomes easier to reference the key instead of its value, contributing to errors that do not present until the application finally deploys in a Kubernetes context. When I started using the pattern proposed in this PR a few years ago, I noticed the ease and speed with which my Kubernetes deployments improved. In this PR, I've additionally added a few convenience methods such as checking whether an environment variable is missing and setting default values. Best, Damon