internal/config: support env var for bucket
The GCS bucket for overrides can now be configured with an environment
variable.
For golang/go#41483
Trust: Jonathan Amsterdam
Run-TryBot: Jonathan Amsterdam
TryBot-Result: kokoro
@@ -455,10 +455,10 @@ func Init(ctx context.Context) (_ *Config, err error) {
}
// If GO_DISCOVERY_CONFIG_OVERRIDE is set, it should point to a file in a
- // bucket named after the project which provides overrides for selected
+ // configured bucket project which provides overrides for selected
// configuration. Use this when you want to fix something in prod quickly,
// without waiting to re-deploy. (Otherwise, do not use it.)
- overrideBucket := cfg.ProjectID
+ overrideBucket := GetEnv("GO_DISCOVERY_CONFIG_BUCKET", cfg.ProjectID)
overrideObj := os.Getenv("GO_DISCOVERY_CONFIG_OVERRIDE")
if overrideObj != "" {
overrideBytes, err := readOverrideFile(ctx, overrideBucket, overrideObj)
