From 6f984eca1cab903fc42e41d4663186c3f8930518 Mon Sep 17 00:00:00 2001
From: Andrew Bonventre <andybons@golang.org>
Date: Thu, 24 May 2018 14:41:55 -0400
Subject: blog: clean up blog to allow usage with gcloud command

+ The app.yaml file needs to be in the same directory as the
  entry-point Go files, so those are moved from ./blog to ./
+ Go files within the context article did not have the +build OMIT
  directive, so gcloud would view them as files that needed to be
  built at deploy time. Add the +build OMIT directive and use
  the context package instead of x/net/context.
+ Switch to using a service instead of version and update app.yaml
  to account for this.
+ Use 1.9 as the runtime.
+ Remove superfluous .gitignore

Change-Id: I7c886849b912bc7f5b67cd2791cb6986d93d5cc7
Reviewed-on: https://go-review.googlesource.com/114455
Reviewed-by: Russ Cox <rsc@golang.org>
---
 appengine.go | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 appengine.go

(limited to 'appengine.go')

diff --git a/appengine.go b/appengine.go
new file mode 100644
index 0000000..288247e
--- /dev/null
+++ b/appengine.go
@@ -0,0 +1,28 @@
+// Copyright 2013 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build appengine
+
+// This file implements an App Engine blog server.
+
+package main
+
+import (
+	"net/http"
+
+	"golang.org/x/tools/blog"
+)
+
+func init() {
+	config.ContentPath = "content/"
+	config.TemplatePath = "template/"
+	s, err := blog.NewServer(config)
+	if err != nil {
+		panic(err)
+	}
+	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+		w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")
+		s.ServeHTTP(w, r)
+	})
+}
-- 
cgit v1.2.3