cmd/golangorg: fix go.dev in go-discovery
I had hoped go.dev would be running in golang-org by this point in the stack,
but it needs to keep running in go-discovery for a little bit longer.
Make that work.
Change-Id: I5e2c155e6b118ef474758fd443d519ea351bd86b
Reviewed-on: https://go-review.googlesource.com/c/website/+/342898
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
diff --git a/cmd/golangorg/godevapp.yaml b/cmd/golangorg/godevapp.yaml
index a93e566..b77db6c 100644
--- a/cmd/golangorg/godevapp.yaml
+++ b/cmd/golangorg/godevapp.yaml
@@ -2,6 +2,9 @@
service: go-dev
main: ./cmd/golangorg
+env_variables:
+ GODEV_IN_GO_DISCOVERY: true
+
handlers:
- url: /.*
secure: always
diff --git a/cmd/golangorg/server.go b/cmd/golangorg/server.go
index 54f3c86..97be166 100644
--- a/cmd/golangorg/server.go
+++ b/cmd/golangorg/server.go
@@ -99,8 +99,14 @@
handler := NewHandler(*contentDir, *goroot)
- handler = webtest.HandlerWithCheck(handler, "/_readycheck",
- filepath.Join(*contentDir, "../cmd/golangorg/testdata/*.txt"))
+ if os.Getenv("GODEV_IN_GO_DISCOVERY") != "" {
+ // Running in go-discovery for a little longer, do not expect the golang-org prod setup.
+ handler = webtest.HandlerWithCheck(handler, "/_readycheck",
+ filepath.Join(*contentDir, "../cmd/golangorg/testdata/godev.txt"))
+ } else {
+ handler = webtest.HandlerWithCheck(handler, "/_readycheck",
+ filepath.Join(*contentDir, "../cmd/golangorg/testdata/*.txt"))
+ }
if *verbose {
log.Printf("golang.org server:")
@@ -301,6 +307,12 @@
func appEngineSetup(site *web.Site, mux *http.ServeMux) {
googleAnalytics = os.Getenv("GOLANGORG_ANALYTICS")
+ log.Printf("GODEV_IN_GO_DISCOVERY %q PROJECT %q", os.Getenv("GODEV_IN_GO_DISCOVERY"), os.Getenv("PROJECT_ID"))
+ if os.Getenv("GODEV_IN_GO_DISCOVERY") != "" {
+ // Running in go-discovery for a little longer, do not expect the golang-org prod setup.
+ return
+ }
+
ctx := context.Background()
datastoreClient, err := datastore.NewClient(ctx, "")