Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: milo/appengine/logs/main.go

Issue 2949783002: [milo] appengine/* -> * (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/appengine/logs/logs.go ('k') | milo/appengine/logs/module-logs.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/logs/main.go
diff --git a/milo/appengine/logs/main.go b/milo/appengine/logs/main.go
deleted file mode 100644
index 2599bea0c9e24ccdaa1e5072c442dcee44afd7f0..0000000000000000000000000000000000000000
--- a/milo/appengine/logs/main.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2017 The LUCI Authors. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package main
-
-import (
- "fmt"
- "log"
- "net/http"
- "strings"
-
- "github.com/luci/luci-go/milo/appengine/common"
- "github.com/luci/luci-go/server/auth"
- "github.com/luci/luci-go/server/router"
-)
-
-// Where it all begins!!!
-func main() {
- r := router.New()
-
- base := common.FlexBase()
- r.GET("/log/raw/*path", base, rawLog)
-
- // Health check, for the appengine flex environment.
- http.HandleFunc("/_ah/health", healthCheckHandler)
- // And everything else.
- http.Handle("/", r)
-
- log.Print("Listening on port 8080")
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
-
-func page(c *router.Context, status int, msg string) {
- c.Writer.WriteHeader(status)
- fmt.Fprintf(c.Writer, msg)
-}
-
-func errorPage(c *router.Context, msg string) {
- page(c, http.StatusInternalServerError, msg)
-}
-
-func rawLog(c *router.Context) {
- path := c.Params.ByName("path")
- if path == "" {
- page(c, http.StatusBadRequest, "missing path")
- return
- }
- path = strings.TrimLeft(path, "/")
- host := c.Request.FormValue("host")
- if host == "" {
- host = "luci-logdog.appspot.com"
- }
- err := logHandler(c.Context, c.Writer, host, path)
- switch err {
- case nil:
- // Everything is fine
- case errNoAuth:
- // Redirect to login page
- loginURL, err := auth.LoginURL(c.Context, c.Request.URL.Path)
- if err != nil {
- fmt.Fprintf(c.Writer, "Encountered error generating login url: %s\n", err.Error())
- return
- }
- http.Redirect(c.Writer, c.Request, loginURL, http.StatusTemporaryRedirect)
- return
- default:
- fmt.Fprintf(c.Writer, "Encountered error: %s", err.Error())
- }
-}
-
-func healthCheckHandler(w http.ResponseWriter, r *http.Request) {
- fmt.Fprint(w, "ok")
-}
« no previous file with comments | « milo/appengine/logs/logs.go ('k') | milo/appengine/logs/module-logs.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698