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

Unified Diff: tools/bug_chomper/src/server/server.go

Issue 649663003: bug_chomper: Make server's port configurable. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | « tools/bug_chomper/run_server.sh ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bug_chomper/src/server/server.go
diff --git a/tools/bug_chomper/src/server/server.go b/tools/bug_chomper/src/server/server.go
index a20c679107e09d842fb2b9aee41681096b715762..fcd1ccc3ef283d94c89e77155343bad5b142cde6 100644
--- a/tools/bug_chomper/src/server/server.go
+++ b/tools/bug_chomper/src/server/server.go
@@ -35,7 +35,6 @@ const (
issueComment = "Edited by BugChomper"
oauthCallbackPath = "/oauth2callback"
oauthConfigFile = "oauth_client_secret.json"
- defaultPort = 8000
localHost = "127.0.0.1"
maxSessionLen = time.Duration(3600 * time.Second)
priorityPrefix = "Priority-"
@@ -43,6 +42,11 @@ const (
cookieName = "BugChomperCookie"
)
+// Flags:
+var (
+ port = flag.String("port", ":8000", "HTTP service address (e.g., ':8000')")
+)
+
var (
scheme = "http"
@@ -362,17 +366,16 @@ func main() {
http.HandleFunc("/", handleRoot)
http.HandleFunc(oauthCallbackPath, handleOAuth2Callback)
http.Handle("/res/", http.FileServer(http.Dir(curdir)))
- port := ":" + strconv.Itoa(defaultPort)
- log.Println("Server is running at " + scheme + "://" + localHost + port)
+ log.Println("Server is running at " + scheme + "://" + localHost + *port)
var err error
if public {
log.Println("WARNING: This server is not secure and should not be made " +
"publicly accessible.")
scheme = "https"
- err = http.ListenAndServeTLS(port, certFile, keyFile, nil)
+ err = http.ListenAndServeTLS(*port, certFile, keyFile, nil)
} else {
scheme = "http"
- err = http.ListenAndServe(localHost+port, nil)
+ err = http.ListenAndServe(localHost+*port, nil)
}
if err != nil {
log.Println(err.Error())
« no previous file with comments | « tools/bug_chomper/run_server.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698