Skip to content

Commit

Permalink
docd: fallback to AppEngine env vars when flags not provided (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathaningram authored Sep 20, 2022
1 parent f481425 commit 106aaad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"
"net/http"
"os"

"cloud.google.com/go/errorreporting"

Expand Down Expand Up @@ -40,6 +41,12 @@ func main() {

var er internal.ErrorReporter = &internal.NopErrorReporter{}
if *errorReporting {
if *errorReportingGCPProjectID == "" {
*errorReportingGCPProjectID = os.Getenv("GOOGLE_CLOUD_PROJECT")
}
if *errorReportingAppEngineService == "" {
*errorReportingAppEngineService = os.Getenv("GAE_SERVICE")
}
var err error
er, err = errorreporting.NewClient(context.Background(), *errorReportingGCPProjectID, errorreporting.Config{
ServiceName: *errorReportingAppEngineService,
Expand Down

0 comments on commit 106aaad

Please sign in to comment.