Skip to content

Commit

Permalink
godev/cmd: use GO_TELEMETRY_ENV instead of ENV
Browse files Browse the repository at this point in the history
Environment variable named 'ENV' can have special meaning.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html#tag_20_117_08

Fixes golang/go#62138

Change-Id: I1c0b6d62aa51f9e726bd21164b58b334ee3f7356
Reviewed-on: https://go-review.googlesource.com/c/telemetry/+/521595
Reviewed-by: Jamal Carvalho <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
  • Loading branch information
hyangah committed Aug 21, 2023
1 parent c38c7ff commit 95548c4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions godev/cmd/telemetrygodev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cloud storage emulator and use the -gcs flag to use the Cloud Storage API.
| GO_TELEMETRY_LOCAL_STORAGE | .localstorage | Directory for storage emulator I/O or file system storage |
| GO_TELEMETRY_UPLOAD_CONFIG | ../config/config.json | Location of the upload config used for report validation |
| GO_TELEMETRY_MAX_REQUEST_BYTES | 102400 | Maximum request body size the server allows |
| GO_TELEMETRY_ENV | local | Deployment environment (e.g. prod, dev, local, ... ) |

## Testing

Expand Down
2 changes: 1 addition & 1 deletion godev/cmd/telemetrygodev/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ steps:
- "--region"
- "us-central1"
- "--set-env-vars"
- "ENV=$_ENV"
- "GO_TELEMETRY_ENV=$_ENV"
images:
- "gcr.io/$PROJECT_ID/telemetrygodev:$COMMIT_SHA"
2 changes: 1 addition & 1 deletion godev/cmd/telemetrygodev/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func newConfig() *config {
ProjectID: env("GO_TELEMETRY_PROJECT_ID", "go-telemetry"),
StorageEmulatorHost: env("GO_TELEMETRY_STORAGE_EMULATOR_HOST", "localhost:8081"),
LocalStorage: env("GO_TELEMETRY_LOCAL_STORAGE", ".localstorage"),
UploadBucket: env("ENV", "local") + "-telemetry-uploaded",
UploadBucket: env("GO_TELEMETRY_ENV", "local") + "-telemetry-uploaded",
UploadConfig: env("GO_TELEMETRY_UPLOAD_CONFIG", "../config/config.json"),
MaxRequestBytes: env("GO_TELEMETRY_MAX_REQUEST_BYTES", int64(100*1024)),
RequestTimeout: 10 * time.Duration(time.Minute),
Expand Down
1 change: 1 addition & 0 deletions godev/cmd/worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cloud storage emulator and use the -gcs flag to use the Cloud Storage API.
| GO_TELEMETRY_LOCAL_STORAGE | .localstorage | Directory for storage emulator I/O or file system storage |
| GO_TELEMETRY_UPLOAD_CONFIG | ../config/config.json | Location of the upload config used for report validation |
| GO_TELEMETRY_MAX_REQUEST_BYTES | 102400 | Maximum request body size the server allows |
| GO_TELEMETRY_ENV | local | Deployment environment (e.g. prod, dev, local, ... ) |

## Testing

Expand Down
2 changes: 1 addition & 1 deletion godev/cmd/worker/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ steps:
- "--region"
- "us-central1"
- "--set-env-vars"
- "ENV=$_ENV"
- "GO_TELEMETRY_ENV=$_ENV"
images:
- "gcr.io/$PROJECT_ID/worker:$COMMIT_SHA"
2 changes: 1 addition & 1 deletion godev/cmd/worker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var (

// newConfig returns a new config. Getting the config should follow a call to flag.Parse.
func newConfig() *config {
environment := env("ENV", "local")
environment := env("GO_TELEMETRY_ENV", "local")
return &config{
Port: env("PORT", "8082"),
ProjectID: env("GO_TELEMETRY_PROJECT_ID", "go-telemetry"),
Expand Down

0 comments on commit 95548c4

Please sign in to comment.